Refactor service user handling, user cache lookup, and cache loading

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
bcmmbaga
2024-11-01 20:27:52 +03:00
parent fed48de83f
commit fa5db7d7ee
5 changed files with 99 additions and 110 deletions

View File

@@ -119,6 +119,19 @@ func NewGetUserFromStoreError() error {
return Errorf(Internal, "issue getting user from store")
}
func NewUnauthorizedToViewUsersError() error {
return Errorf(PermissionDenied, "only users with admin power can view users")
}
func NewUnauthorizedToViewServiceUsersError() error {
return Errorf(PermissionDenied, "only users with admin power can view service users")
}
// NewServiceUserRoleInvalidError creates a new Error with InvalidArgument type for creating a service user with owner role
func NewServiceUserRoleInvalidError() error {
return Errorf(InvalidArgument, "can't create a service user with owner role")
}
// NewInvalidKeyIDError creates a new Error with InvalidArgument type for an issue getting a setup key
func NewInvalidKeyIDError() error {
return Errorf(InvalidArgument, "invalid key ID")