mirror of https://github.com/jumpserver/jumpserver
fix: user is common user
parent
a936092020
commit
2cb08b4785
|
@ -59,7 +59,7 @@ class CommandExecutionViewSet(RootOrgViewMixin, viewsets.ModelViewSet):
|
|||
raise ValidationError({"hosts": msg})
|
||||
|
||||
def check_permissions(self, request):
|
||||
if not settings.SECURITY_COMMAND_EXECUTION and request.user.is_common_user:
|
||||
if not settings.SECURITY_COMMAND_EXECUTION:
|
||||
return self.permission_denied(request, "Command execution disabled")
|
||||
return super().check_permissions(request)
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ auditor_perms = user_perms + (
|
|||
('ops', 'commandexecution', 'view', 'commandexecution')
|
||||
)
|
||||
|
||||
|
||||
app_exclude_perms = [
|
||||
('users', 'user', 'add,delete', 'user'),
|
||||
('orgs', 'org', 'add,delete,change', 'org'),
|
||||
|
@ -59,7 +58,8 @@ class PredefineRole:
|
|||
from rbac.models import Role
|
||||
return Role.objects.get(id=self.id)
|
||||
|
||||
def _get_defaults(self):
|
||||
@property
|
||||
def default_perms(self):
|
||||
from rbac.models import Permission
|
||||
q = Permission.get_define_permissions_q(self.perms)
|
||||
permissions = Permission.get_permissions(self.scope)
|
||||
|
@ -72,6 +72,10 @@ class PredefineRole:
|
|||
permissions = permissions.exclude(q)
|
||||
|
||||
perms = permissions.values_list('id', flat=True)
|
||||
return perms
|
||||
|
||||
def _get_defaults(self):
|
||||
perms = self.default_perms
|
||||
defaults = {
|
||||
'id': self.id, 'name': self.name, 'scope': self.scope,
|
||||
'builtin': True, 'permissions': perms
|
||||
|
|
Loading…
Reference in New Issue