Interface CredentialAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
CredentialBatchAdminSession

public interface CredentialAdminSession extends OsidSession

This session creates, updates, and deletes Credentials . The data for create and update is provided by the consumer via the form object. OsidForms are requested for each create or update and may not be reused.

Create and update operations differ in their usage. To create a Credential , a CredentialForm is requested using getCredentialFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned CredentialForm will indicate that it is to be used with a create operation and can be used to examine metdata or validate data prior to creation. Once the CredentialForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each CredentialForm corresponds to an attempted transaction.

For updates, CredentialForms are requested to the CredentialForm Id that is to be updated using getCredentialFormForUpdate() . Similarly, the CredentialForm has metadata about the data that can be updated and it can perform validation before submitting the update. The CredentialForm can only be used once for a successful update and cannot be reused.

The delete operations delete CredentialForms . To unmap a CredentialForm from the current CourseCatalog , the CredentialFormCourseCatalogAssignmentSession should be used. These delete operations attempt to remove the CredentialForm itself thus removing it from all known CourseCatalog catalogs.

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

  • Method Details

    • getCourseCatalogId

      Id getCourseCatalogId()
      Gets the CourseCatalog Id associated with this session.
      Returns:
      the CourseCatalog Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getCourseCatalog

      Gets the CourseCatalog associated with this session.
      Returns:
      the course catalog
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateCredentials

      boolean canCreateCredentials()
      Tests if this user can create Credentials . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a credential will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.
      Returns:
      false if Credential creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateCredentialWithRecordTypes

      boolean canCreateCredentialWithRecordTypes(Type[] credentialRecordTypes)
      Tests if this user can create a single Credential using the desired record types. While CourseProgramManager.getCredentialRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Credential . Providing an empty array tests if a Credential can be created with no records.
      Parameters:
      credentialRecordTypes - array of credential record types
      Returns:
      true if Credential creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - credentialRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getCredentialFormForCreate

      CredentialForm getCredentialFormForCreate(Type[] credentialRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the credential form for creating new credentials. A new form should be requested for each create transaction.
      Parameters:
      credentialRecordTypes - array of credential record types
      Returns:
      the credential form
      Throws:
      NullArgumentException - credentialRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createCredential

      Creates a new Credential .
      Parameters:
      credentialForm - the form for this Credential
      Returns:
      the new Credential
      Throws:
      IllegalStateException - credentialForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - credentialForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - credentialForm did not originate from getCredentialFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateCredentials

      boolean canUpdateCredentials()
      Tests if this user can update Credentials . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a credential will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.
      Returns:
      false if credential modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getCredentialFormForUpdate

      CredentialForm getCredentialFormForUpdate(Id credentialId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the credential form for updating an existing credential. A new credential form should be requested for each update transaction.
      Parameters:
      credentialId - the Id of the credential
      Returns:
      the credential form
      Throws:
      NotFoundException - credentialId is not found
      NullArgumentException - credentialId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateCredential

      void updateCredential(CredentialForm credentialForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing credential.
      Parameters:
      credentialForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - credentialForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - credentialForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - credentialForm did not originate from getCredentialFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteCredentials

      boolean canDeleteCredentials()
      Tests if this user can delete Credentials . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Credential will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.
      Returns:
      false if credential deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteCredential

      void deleteCredential(Id credentialId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes a Credential .
      Parameters:
      credentialId - the Id of the Credential to remove
      Throws:
      NotFoundException - credentialId not found
      NullArgumentException - credentialId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageCredentialAliases

      boolean canManageCredentialAliases()
      Tests if this user can manage Id aliases for Credentials . A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
      Returns:
      false if credential aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasCredential

      void aliasCredential(Id credentialId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds an Id to a credential for the purpose of creating compatibility. The primary Id of the Credential is determined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another credential, it is reassigned to the given credential Id .
      Parameters:
      credentialId - the Id of a credential
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is in use as a primary Id
      NotFoundException - credentialId not found
      NullArgumentException - credentialId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.