mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-14 04:17:36 -04:00
Remove bootstrapping workaround for ListRoleAssignments
Previously ListRoleAssignments needed to be able to return the default assignments when the metadata client was not initialized. This was added in order to be able to bootstrap the metadata client (which caused a call to ListRoleAssignments by itself). With the recent switch to a separate user-provider and permissions service for the metadata storage this no longer needed.
This commit is contained in:
committed by
Ralf Haferkamp
parent
78dd771c76
commit
15fabb155f
@@ -7,15 +7,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/owncloud/ocis/v2/extensions/settings/pkg/store/defaults"
|
||||
settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0"
|
||||
)
|
||||
|
||||
// ListRoleAssignments loads and returns all role assignments matching the given assignment identifier.
|
||||
func (s *Store) ListRoleAssignments(accountUUID string) ([]*settingsmsg.UserRoleAssignment, error) {
|
||||
if s.mdc == nil {
|
||||
return s.defaultRoleAssignments(accountUUID), nil
|
||||
}
|
||||
s.Init()
|
||||
ctx := context.TODO()
|
||||
assIDs, err := s.mdc.ReadDir(ctx, accountPath(accountUUID))
|
||||
@@ -92,16 +88,6 @@ func (s *Store) RemoveRoleAssignment(assignmentID string) error {
|
||||
return fmt.Errorf("assignmentID '%s' not found", assignmentID)
|
||||
}
|
||||
|
||||
func (s *Store) defaultRoleAssignments(accID string) []*settingsmsg.UserRoleAssignment {
|
||||
var assmnts []*settingsmsg.UserRoleAssignment
|
||||
for _, r := range defaults.DefaultRoleAssignments(s.cfg) {
|
||||
if r.AccountUuid == accID {
|
||||
assmnts = append(assmnts, r)
|
||||
}
|
||||
}
|
||||
return assmnts
|
||||
}
|
||||
|
||||
func accountPath(accountUUID string) string {
|
||||
return fmt.Sprintf("%s/%s", accountsFolderLocation, accountUUID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user