mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: rename router package
This commit is contained in:
38
server/router/api/v1/acl_config.go
Normal file
38
server/router/api/v1/acl_config.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package v1
|
||||
|
||||
var authenticationAllowlistMethods = map[string]bool{
|
||||
"/memos.api.v1.WorkspaceService/GetWorkspaceProfile": true,
|
||||
"/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting": true,
|
||||
"/memos.api.v1.WorkspaceSettingService/ListWorkspaceSettings": true,
|
||||
"/memos.api.v1.IdentityProviderService/ListIdentityProviders": true,
|
||||
"/memos.api.v1.IdentityProviderService/GetIdentityProvider": true,
|
||||
"/memos.api.v1.AuthService/GetAuthStatus": true,
|
||||
"/memos.api.v1.AuthService/SignIn": true,
|
||||
"/memos.api.v1.AuthService/SignInWithSSO": true,
|
||||
"/memos.api.v1.AuthService/SignOut": true,
|
||||
"/memos.api.v1.AuthService/SignUp": true,
|
||||
"/memos.api.v1.UserService/GetUser": true,
|
||||
"/memos.api.v1.UserService/GetUserAvatar": true,
|
||||
"/memos.api.v1.UserService/SearchUsers": true,
|
||||
"/memos.api.v1.MemoService/ListMemos": true,
|
||||
"/memos.api.v1.MemoService/GetMemo": true,
|
||||
"/memos.api.v1.MemoService/SearchMemos": true,
|
||||
"/memos.api.v1.MemoService/ListMemoResources": true,
|
||||
"/memos.api.v1.MemoService/ListMemoRelations": true,
|
||||
"/memos.api.v1.MemoService/ListMemoComments": true,
|
||||
"/memos.api.v1.LinkService/GetLinkMetadata": true,
|
||||
}
|
||||
|
||||
// isUnauthorizeAllowedMethod returns whether the method is exempted from authentication.
|
||||
func isUnauthorizeAllowedMethod(fullMethodName string) bool {
|
||||
return authenticationAllowlistMethods[fullMethodName]
|
||||
}
|
||||
|
||||
var allowedMethodsOnlyForAdmin = map[string]bool{
|
||||
"/memos.api.v1.UserService/CreateUser": true,
|
||||
}
|
||||
|
||||
// isOnlyForAdminAllowedMethod returns true if the method is allowed to be called only by admin.
|
||||
func isOnlyForAdminAllowedMethod(methodName string) bool {
|
||||
return allowedMethodsOnlyForAdmin[methodName]
|
||||
}
|
Reference in New Issue
Block a user