Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
project permissions:
* PROJECT_READ
* PROJECT_WRITE
* PROJECT_ADMIN
"""
return self._client.put(self.url(), params=dict(name=group, permission=permission))
@ok_or_error
def revoke(self, group):
"""
Revoke all permissions for a group.
"""
return self._client.delete(self.url(), params=dict(name=group))
class Users(ResourceBase, FilteredIterableResource):
def none(self, filter=None):
"""
Retrieve users that have no granted permissions.
filter: if specified only user names containing the supplied string will be returned
"""
params = {}
if filter:
params['filter'] = filter
return self.paginate("/none", params)
@ok_or_error
def grant(self, user, permission):
"""
Promote or demote the permission level of a user.
from ..helpers import ResourceBase, FilteredIterableResource
from ..errors import ok_or_error, response_or_error
from ..compat import update_doc
class Groups(ResourceBase, FilteredIterableResource):
@response_or_error
def add(self, group):
"""
Add a group, returns a dictionary containing the group name
"""
return self._client.post(self.url(), {}, params=dict(name=group))
@ok_or_error
def delete(self, group):
"""
Delete a group.
"""
return self._client.delete(self.url(), params=dict(name=group))
@ok_or_error
def add_user(self, group, user):
from ..helpers import ResourceBase, FilteredIterableResource
from ..errors import ok_or_error, response_or_error
from ..compat import update_doc
class Users(ResourceBase, FilteredIterableResource):
@response_or_error
def add(self, name, password, displayName, emailAddress, addToDefaultGroup=True):
"""
Add a user, returns a dictionary containing information about the newly created user
"""
params = dict(name=name,
password=password,
displayName=displayName,
emailAddress=emailAddress,
addToDefaultGroup=addToDefaultGroup)
return self._client.post(self.url(), params=params)
@ok_or_error
def delete(self, user):
"""
from .helpers import ResourceBase, Nested, FilteredIterableResource
from .errors import ok_or_error
from .compat import update_doc
class Groups(ResourceBase, FilteredIterableResource):
def none(self, filter=None):
"""
Retrieve groups that have no granted permissions.
filter: return only group names containing the supplied string will be returned
"""
params = {}
if filter:
params['filter'] = filter
return self.paginate("/none", params)
@ok_or_error
def grant(self, group, permission):
"""
Promote or demote a user's permission level.