Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'name': 'System',
'children': [
]
},
{
'attach': None,
'id': 'category:other',
'name': 'Other',
'children': [
]
},
]
@component(PermissionProvider)
class Permissions (PermissionProvider):
def provide(self):
sidebar_perms = [
{
'id': 'sidebar:view:%s' % item['url'],
'name': item['name'],
'default': True,
}
for provider in SidebarItemProvider.all(self.context)
for item in provider.provide()
if 'url' in item
]
return [
{
'id': 'core:config:read',
'name': 'Read configuration file',
'default': True,
def provide(self):
return [
{
'attach': 'category:system',
'id': 'network',
'name': _('Network'),
'icon': 'plug',
'url': '/view/network',
'children': [],
}
]
@component(PermissionProvider)
class Permissions(PermissionProvider):
def provide(self):
return [
{
'id': 'network:configure',
'name': _('Configure network interfaces'),
'default': True,
},
{
'id': 'network:updown',
'name': _('Activate/deactivate network interfaces'),
'default': True,
},
self.context = context
def provide(self):
return [
{
'attach': 'category:system',
'id': 'datetime',
'name': _('Date & time'),
'icon': 'clock-o',
'url': '/view/datetime',
'children': [],
}
]
@component(PermissionProvider)
class Permissions(PermissionProvider):
def provide(self):
return [
{
'id': 'datetime:write',
'name': _('Change date and time'),
'default': True,
},
'children': [],
} for mgr in PackageManager.all(self.context)]
return [
{
'attach': 'category:system',
'id': 'packages',
'name': _('Packages'),
'icon': 'gift',
'url': '/view/packages/%s' % PackageManager.all(self.context, ignore_exceptions=True)[0].id,
'children': children,
}
]
@component(PermissionProvider)
class Permissions (PermissionProvider):
def provide(self):
return [
{
'id': 'packages:install',
'name': _('Install/remove packages'),
'default': True,
},
'id': 'category:system',
'name': 'System',
'children': [
]
},
{
'attach': None,
'id': 'category:other',
'name': 'Other',
'children': [
]
},
]
@component(PermissionProvider)
class Permissions (PermissionProvider):
def provide(self):
sidebar_perms = [
{
'id': 'sidebar:view:%s' % item['url'],
'name': item['name'],
'default': True,
}
for provider in SidebarItemProvider.all(self.context)
for item in provider.provide()
if 'url' in item
]
return [
{
'id': 'core:config:read',
'name': 'Read configuration file',
from jadi import component
from aj.auth import PermissionProvider
@component(PermissionProvider)
class Permissions (PermissionProvider):
def provide(self):
return [
{
'id': 'filesystem:read',
'name': _('Read from the filesystem'),
'default': True,
},
{
'id': 'filesystem:write',
'name': _('Write to the filesystem'),
'default': True,
},
self.context = context
def provide(self):
return [
{
'attach': 'category:system',
'id': 'network',
'name': _('Network'),
'icon': 'plug',
'url': '/view/network',
'children': [],
}
]
@component(PermissionProvider)
class Permissions(PermissionProvider):
def provide(self):
return [
{
'id': 'network:configure',
'name': _('Configure network interfaces'),
'default': True,
},
{
'id': 'network:updown',
'name': _('Activate/deactivate network interfaces'),
'default': True,
},
'url': '/view/services/%s' % mgr.id,
'children': [],
} for mgr in ServiceManager.all(self.context)]
return [
{
'attach': 'category:software',
'name': 'Services',
'icon': 'cogs',
'url': '/view/services',
'children': children
}
]
@component(PermissionProvider)
class Permissions (PermissionProvider):
def provide(self):
return [
{
'id': 'services:manage',
'name': 'Manage system services',
'default': True,
},
def provide(self):
return [
{
'attach': 'category:system',
'id': 'datetime',
'name': _('Date & time'),
'icon': 'clock-o',
'url': '/view/datetime',
'children': [],
}
]
@component(PermissionProvider)
class Permissions(PermissionProvider):
def provide(self):
return [
{
'id': 'datetime:write',
'name': _('Change date and time'),
'default': True,
},
def handle_api_permissions(self, http_context):
r = []
for p in PermissionProvider.all(self.context):
r += p.provide()
return r