projectal.entities.user API documentation

# projectal.entities.user

View Source

    from projectal import api
    from projectal.entity import Entity
    from projectal.linkers import *

    class User(Entity, AccessPolicyLinker, PermissionLinker):
        """
        Implementation of the [User](https://projectal.com/docs/latest/#tag/User) API.
        """
        _path = 'user'
        _name = 'USER'

        @classmethod
        def register(cls, user):
            url = '/api/user/registration/{}'.format(user['uuId'])
            api.post(url, is_json=False)
            return True

        @classmethod
        def current_user_permissions(cls):
            """
            Get the authenticated user's permissions as a list.
            """
            return api.get('/api/user/permissions')['permissions']

        def bulk_user_link_permission(self, permission):
            self.__permission(self, permission, 'add')

        def bulk_user_unlink_permission(self, permission):
            self.__permission(self, permission, 'delete')

        @classmethod
        def __permission(cls, from_user, to_permission, operation):
            url = '/api/user/permission/{}'.format(operation)
            payload = [{
                'uuId': from_user['uuId'],
                'permissionList': [to_permission]
            }]
            api.post(url, payload=payload)
            return True

        @classmethod
        def current_user_details(cls):
            """Get some details about the authenticated user."""
            return api.get('/api/user/details')

        @classmethod
        def get_permissions(cls, user):
            """Get the permissions assigned to a specific User entity."""
            url = '/api/user/get/{}/permissions'.format(user['uuId'])
            return api.get(url)['data']

class User(projectal.entity.Entity, projectal.linkers.AccessPolicyLinker, projectal.linkers.PermissionLinker):
View Source

    class User(Entity, AccessPolicyLinker, PermissionLinker):
        """
        Implementation of the [User](https://projectal.com/docs/latest/#tag/User) API.
        """
        _path = 'user'
        _name = 'USER'

        @classmethod
        def register(cls, user):
            url = '/api/user/registration/{}'.format(user['uuId'])
            api.post(url, is_json=False)
            return True

        @classmethod
        def current_user_permissions(cls):
            """
            Get the authenticated user's permissions as a list.
            """
            return api.get('/api/user/permissions')['permissions']

        def bulk_user_link_permission(self, permission):
            self.__permission(self, permission, 'add')

        def bulk_user_unlink_permission(self, permission):
            self.__permission(self, permission, 'delete')

        @classmethod
        def __permission(cls, from_user, to_permission, operation):
            url = '/api/user/permission/{}'.format(operation)
            payload = [{
                'uuId': from_user['uuId'],
                'permissionList': [to_permission]
            }]
            api.post(url, payload=payload)
            return True

        @classmethod
        def current_user_details(cls):
            """Get some details about the authenticated user."""
            return api.get('/api/user/details')

        @classmethod
        def get_permissions(cls, user):
            """Get the permissions assigned to a specific User entity."""
            url = '/api/user/get/{}/permissions'.format(user['uuId'])
            return api.get(url)['data']

Implementation of the User API.

@classmethod
def register(cls, user):
View Source

        @classmethod
        def register(cls, user):
            url = '/api/user/registration/{}'.format(user['uuId'])
            api.post(url, is_json=False)
            return True

@classmethod
def current_user_permissions(cls):
View Source

        @classmethod
        def current_user_permissions(cls):
            """
            Get the authenticated user's permissions as a list.
            """
            return api.get('/api/user/permissions')['permissions']

Get the authenticated user's permissions as a list.

def bulk_user_link_permission(self, permission):
View Source

        def bulk_user_link_permission(self, permission):
            self.__permission(self, permission, 'add')

def bulk_user_unlink_permission(self, permission):
View Source

        def bulk_user_unlink_permission(self, permission):
            self.__permission(self, permission, 'delete')

@classmethod
def current_user_details(cls):
View Source

        @classmethod
        def current_user_details(cls):
            """Get some details about the authenticated user."""
            return api.get('/api/user/details')

Get some details about the authenticated user.

@classmethod
def get_permissions(cls, user):
View Source

        @classmethod
        def get_permissions(cls, user):
            """Get the permissions assigned to a specific User entity."""
            url = '/api/user/get/{}/permissions'.format(user['uuId'])
            return api.get(url)['data']

Get the permissions assigned to a specific User entity.

##### Inherited Members

projectal.entity.Entity
  Entity
  get
  update
  delete
  create
  save
  clone
  history
  list
  match
  match_startswith
  match_endswith
  search
  query
  profile_get
  profile_set
  changes
  set_readonly
projectal.linkers.AccessPolicyLinker
  link_access_policy
  unlink_access_policy
projectal.linkers.PermissionLinker
  link_permission
  unlink_permission
builtins.dict
  setdefault
  pop
  popitem
  keys
  items
  values
  fromkeys
  clear
  copy