add remaining org/proj/user initial sync

This commit is contained in:
Mike Mason
2023-07-11 21:32:30 +00:00
parent 80fb879ef6
commit 11fe8f8f2a
15 changed files with 215 additions and 34 deletions

View File

@@ -47,10 +47,13 @@ type Service interface {
// IsUser checks if the provided id has an id prefix which is a user.
IsUser(id gidx.PrefixedID) bool
// TouchUser triggers a sync of a user and their permissions.
TouchUser(ctx context.Context, id gidx.PrefixedID) error
// DeleteUser deletes the user and their permissions.
DeleteUser(ctx context.Context, id gidx.PrefixedID) error
// AssignUser assigns a user to the given resource.
AssignUser(ctx context.Context, userID gidx.PrefixedID, resourceIDs ...gidx.PrefixedID) error
// RemoveUser removes the users from the given resource.
RemoveUser(ctx context.Context, userID gidx.PrefixedID, resourceIDs ...gidx.PrefixedID) error
// IsAssignableResource checks if the provided resource ID may have assigned users.
IsAssignableResource(id gidx.PrefixedID) bool
}
var _ Service = &service{}
@@ -62,15 +65,15 @@ type service struct {
perms *permissions.Client
idPrefixMap map[string]string
rootResource rootResource
rootResource prefixedID
roles map[string][]string
}
type rootResource struct {
type prefixedID struct {
id gidx.PrefixedID
}
func (r rootResource) PrefixedID() gidx.PrefixedID {
func (r prefixedID) PrefixedID() gidx.PrefixedID {
return r.id
}