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.
Modifier and Type | Method and Description |
---|---|
void |
aliasCredential(Id credentialId,
Id aliasId)
Adds an
Id to a credential for the
purpose of creating compatibility. |
boolean |
canCreateCredentials()
Tests if this user can create
Credentials. |
boolean |
canCreateCredentialWithRecordTypes(Type[] credentialRecordTypes)
Tests if this user can create a single
Credential using
the desired record types. |
boolean |
canDeleteCredentials()
Tests if this user can delete
Credentials. |
boolean |
canManageCredentialAliases()
Tests if this user can manage
Id aliases for
Credentials. |
boolean |
canUpdateCredentials()
Tests if this user can update
Credentials. |
Credential |
createCredential(CredentialForm credentialForm)
Creates a new
Credential. |
void |
deleteCredential(Id credentialId)
Deletes a
Credential. |
CourseCatalog |
getCourseCatalog()
Gets the
CourseCatalog associated with this session. |
Id |
getCourseCatalogId()
Gets the
CourseCatalog Id associated
with this session. |
CredentialForm |
getCredentialFormForCreate(Type[] credentialRecordTypes)
Gets the credential form for creating new credentials.
|
CredentialForm |
getCredentialFormForUpdate(Id credentialId)
Gets the credential form for updating an existing credential.
|
void |
updateCredential(CredentialForm credentialForm)
Updates an existing credential.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getCourseCatalogId()
CourseCatalog
Id
associated
with this session. CourseCatalog Id
associated with this
sessionmandatory
- This method must be implemented. CourseCatalog getCourseCatalog() throws OperationFailedException, PermissionDeniedException
CourseCatalog
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateCredentials()
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. false
if Credential
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateCredentialWithRecordTypes(Type[] credentialRecordTypes)
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.credentialRecordTypes
- array of credential record types true
if Credential
creation
using the specified record Types
is supported,
false
otherwiseNullArgumentException
- credentialRecordTypes
is null
mandatory
- This method must be implemented. CredentialForm getCredentialFormForCreate(Type[] credentialRecordTypes) throws OperationFailedException, PermissionDeniedException
credentialRecordTypes
- array of credential record typesNullArgumentException
- credentialRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Credential createCredential(CredentialForm credentialForm) throws OperationFailedException, PermissionDeniedException
Credential.
credentialForm
- the form for this Credential
Credential
IllegalStateException
- credentialForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- credentialForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- credentialForm
did not originate from getCredentialFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateCredentials()
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. false
if credential
modification
is not authorized, true
otherwisemandatory
- This method must be implemented. CredentialForm getCredentialFormForUpdate(Id credentialId) throws NotFoundException, OperationFailedException, PermissionDeniedException
credentialId
- the Id
of the credential
NotFoundException
- credentialId
is not
foundNullArgumentException
- credentialId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateCredential(CredentialForm credentialForm) throws OperationFailedException, PermissionDeniedException
credentialForm
- the form containing the elements to be updatedIllegalStateException
- credentialForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- credentialForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- credentialForm did not
originate from getCredentialFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteCredentials()
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. false
if credential
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. void deleteCredential(Id credentialId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Credential.
credentialId
- the Id
of the Credential
to removeNotFoundException
- credentialId
not
foundNullArgumentException
- credentialId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageCredentialAliases()
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. false
if credential
aliasing is
not authorized, true
otherwisemandatory
- This method must be implemented. void aliasCredential(Id credentialId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
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.
credentialId
- the Id
of a credential
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- credentialId
not
foundNullArgumentException
- credentialId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.