mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-23 05:59:28 -06:00
graph: Make roleService optional again
Allow to use the /graph/users and /graph/education/users endpoints standalone without the RoleService running. When there is no Roleservice do not expose the `/appRoleAssignments` endpoint.
This commit is contained in:
committed by
Ralf Haferkamp
parent
82021dca5a
commit
ba761a0c3f
@@ -148,11 +148,7 @@ func NewService(opts ...Option) (Graph, error) {
|
||||
svc.permissionsService = options.PermissionService
|
||||
}
|
||||
|
||||
if options.RoleService == nil {
|
||||
svc.roleService = settingssvc.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient())
|
||||
} else {
|
||||
svc.roleService = options.RoleService
|
||||
}
|
||||
svc.roleService = options.RoleService
|
||||
|
||||
roleManager := options.RoleManager
|
||||
if roleManager == nil {
|
||||
@@ -201,11 +197,13 @@ func NewService(opts ...Option) (Graph, error) {
|
||||
r.Get("/", svc.GetUser)
|
||||
r.With(requireAdmin).Delete("/", svc.DeleteUser)
|
||||
r.With(requireAdmin).Patch("/", svc.PatchUser)
|
||||
r.With(requireAdmin).Route("/appRoleAssignments", func(r chi.Router) {
|
||||
r.Get("/", svc.ListAppRoleAssignments)
|
||||
r.Post("/", svc.CreateAppRoleAssignment)
|
||||
r.Delete("/{appRoleAssignmentID}", svc.DeleteAppRoleAssignment)
|
||||
})
|
||||
if svc.roleService != nil {
|
||||
r.With(requireAdmin).Route("/appRoleAssignments", func(r chi.Router) {
|
||||
r.Get("/", svc.ListAppRoleAssignments)
|
||||
r.Post("/", svc.CreateAppRoleAssignment)
|
||||
r.Delete("/{appRoleAssignmentID}", svc.DeleteAppRoleAssignment)
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
r.Route("/groups", func(r chi.Router) {
|
||||
|
||||
Reference in New Issue
Block a user