Class AccountService


@Service public class AccountService extends SpringBaseService
Service to get various account related things
  • Constructor Details

    • AccountService

      public AccountService()
  • Method Details

    • getAllRoles

      public List<CanvasRole> getAllRoles()
      Get all roles that are defined in the system
      Returns:
      List of CanvasRole objects
    • getRolesForAccount

      public List<CanvasRole> getRolesForAccount(String accountId, boolean showInherited)
      Get all the roles for the given accountId
      Parameters:
      accountId - Account id
      showInherited - Flag indicating if all inherited roles should be returned as well
      Returns:
      List of canvas roles available to this account
    • getParentAccounts

      @Cacheable(value="parentAccounts", cacheManager="CanvasServicesCacheManager") public List<Account> getParentAccounts(String accountId)
      Parameters:
      accountId - Account id
      Returns:
      a list of the parent Accounts for the given accountId
    • getAccount

      public Account getAccount(String accountId)
      Get a specific account object from Canvas GET /api/v1/accounts/account_id
      Parameters:
      accountId - Canvas account id. Could also have the form of sis_account_id:account_id
      Returns:
      Account
    • getAccountsForUser

      public List<Account> getAccountsForUser(String userLoginId)
      Get all accounts a given user can access
      Parameters:
      userLoginId - User's login id
      Returns:
      List of accessible accounts
    • isAccountAdmin

      public boolean isAccountAdmin(String accountId, String userId)
      Is the given user an admin in the given account
      Parameters:
      accountId -
      userId -
      Returns:
    • elevateToAccountAdmin

      public boolean elevateToAccountAdmin(String accountId, String userId)
      Elevate the given user to an account admin
      Parameters:
      accountId -
      userId -
      Returns:
    • revokeAsAccountAdmin

      public boolean revokeAsAccountAdmin(String accountId, String userId)
      Demote the given user back to a "regular" user as they no longer need to ba an account admin
      Parameters:
      accountId -
      userId -
      Returns:
    • getSubAccounts

      public List<Account> getSubAccounts()
      Get all subaccounts that are defined in the system
      Returns:
      List of Account objects
    • setSisAccountId

      public Account setSisAccountId(String accountId, String sisAccountId)
      Account with this accountId to use to set the sisAccountId value
      Parameters:
      accountId - - the accountId to use to set
      sisAccountId - - the sisAccountId value to set for account with accountId
      Returns:
      - the account changed
    • getSsoSettings

      public SsoSettings getSsoSettings(String canvasServer)
      GET /api/v1/accounts/:account_id/sso_settings
      Parameters:
      canvasServer -
      Returns:
    • setSsoSettings

      public SsoSettings setSsoSettings(String canvasServer, SsoSettingsWrapper ssoSettingsWrapper)
      PUT /api/v1/accounts/:account_id/sso_settings
      Parameters:
      canvasServer -
      ssoSettingsWrapper -
      Returns:
    • getSaml

      public Saml getSaml(String canvasServer, String samlId)
      GET /api/v1/accounts/:account_id/authentication_providers/:id
      Parameters:
      canvasServer -
      samlId -
      Returns:
    • setSaml

      public void setSaml(String canvasServer, String samlId, Saml newSamlObject)
      PUT /api/v1/accounts/:account_id/authentication_providers/:id
      Parameters:
      canvasServer -
      samlId -
      newSamlObject -