X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ee5443faad325b16047b9ad4cd588baf51e231fa..b517f68ab03879edb3cec475bd1988c2e5fe96bd:/services/api/app/models/group.rb diff --git a/services/api/app/models/group.rb b/services/api/app/models/group.rb index e44e605b16..85855fda97 100644 --- a/services/api/app/models/group.rb +++ b/services/api/app/models/group.rb @@ -268,6 +268,18 @@ class Group < ArvadosModel end end + def permission_to_create + if !super + return false + elsif group_class == "role" && + !Rails.configuration.Users.CanCreateRoleGroups && + !current_user.andand.is_admin + raise PermissionDeniedError.new("this cluster does not allow users to create role groups") + else + return true + end + end + def permission_to_update if !super return false