Class RolesApiImpl

Object
ch.aaap.harvestclient.impl.RolesApiImpl
All Implemented Interfaces:
RolesApi

public class RolesApiImpl extends Object implements RolesApi
  • Constructor Details

    • RolesApiImpl

      public RolesApiImpl(RoleService service)
  • Method Details

    • list

      public List<Role> list()
      Specified by:
      list in interface RolesApi
      Returns:
      a list of all Roles in the account, sorted by creation date, newest first.
    • list

      public Pagination<Role> list(int page, int perPage)
      Specified by:
      list in interface RolesApi
      Parameters:
      page - the page number
      perPage - how many results to return for one page. Max 100
      Returns:
      a list of all Roles in the account, sorted by creation date, newest first.
    • get

      public Role get(Reference<Role> roleReference)
      Description copied from interface: RolesApi
      Return an existing Role.
      Specified by:
      get in interface RolesApi
      Parameters:
      roleReference - a reference to an existing Role
      Returns:
      the full Role object
    • create

      public Role create(RoleInfo roleInfo)
      Description copied from interface: RolesApi
      Create a new Role
      Specified by:
      create in interface RolesApi
      Parameters:
      roleInfo - creation information
      Returns:
      the created Role
    • update

      public Role update(Reference<Role> roleReference, RoleInfo toChange)
      Description copied from interface: RolesApi
      Updates the specific role by setting the values of the parameters passed. Any parameters not provided will be left unchanged
      Specified by:
      update in interface RolesApi
      Parameters:
      roleReference - An existing Role to be updated
      toChange - the changes to be performed
      Returns:
      the updated Role
    • addUser

      public Role addUser(Reference<Role> roleReference, Reference<User> userReference)
      Description copied from interface: RolesApi
      Add a role to a user
      Specified by:
      addUser in interface RolesApi
      Parameters:
      roleReference - the role to be assigned
      userReference - the user that will be assigned the role
      Returns:
      the updated Role
    • removeUser

      public Role removeUser(Reference<Role> roleReference, Reference<User> userReference)
      Description copied from interface: RolesApi
      Removes the given role from the given user
      Specified by:
      removeUser in interface RolesApi
      Parameters:
      roleReference - the role to be removed
      userReference - the user that will lose the role
      Returns:
      the updated Role
    • delete

      public void delete(Reference<Role> roleReference)
      Description copied from interface: RolesApi
      Delete an existing Role. Will unlink it from any users assigned to it.
      Specified by:
      delete in interface RolesApi
      Parameters:
      roleReference - a reference to the Role to be deleted