GetPermissions returns all permissions for the given role. Role format is roles/{role}.
(ctx context.Context, workspaceID string, roleName string)
| 89 | // GetPermissions returns all permissions for the given role. |
| 90 | // Role format is roles/{role}. |
| 91 | func (m *Manager) GetPermissions(ctx context.Context, workspaceID string, roleName string) (map[permission.Permission]bool, error) { |
| 92 | resourceID := strings.TrimPrefix(roleName, "roles/") |
| 93 | role, err := m.store.GetRoleSnapshot(ctx, workspaceID, resourceID) |
| 94 | if err != nil { |
| 95 | return nil, err |
| 96 | } |
| 97 | if role == nil { |
| 98 | return nil, nil |
| 99 | } |
| 100 | return maps.Clone(role.Permissions), nil |
| 101 | } |
| 102 | |
| 103 | func (m *Manager) GetUserGroups(ctx context.Context, workspaceID string, email string) ([]string, error) { |
| 104 | return m.store.GetUserGroupsSnapshot(ctx, workspaceID, common.FormatUserEmail(email)) |
no test coverage detected