public interface KeyAdminSession extends OsidSession
This session provides methods to creating, updating and deleting
Key
objects. Keys are managed separately from the Agent.
Each Agent
maps to a zero or one Key
and every Key
maps to one Agent.
Modifier and Type | Method and Description |
---|---|
boolean |
canCreateKeys()
Tests if this user can create
Keys. |
boolean |
canCreateKeyWithRecordTypes(Type[] keyRecordTypes)
Tests if this user can create a single
Key using the
desired record interface types. |
boolean |
canDeleteKeys()
Tests if this user can delete
Keys. |
boolean |
canUpdateKeys()
Tests if this user can update
Keys. |
Key |
createKey(KeyForm keyForm)
Creates a new
Key. |
void |
deleteKey(Id keyId)
Deletes a
Key. |
Agency |
getAgency()
Gets the
Agency associated with this session. |
Id |
getAgencyId()
Gets the
Agency Id associated with this
session. |
KeyForm |
getKeyFormForCreate(Id agentId,
Type[] keyRecordTypes)
Gets the key form for creating and updating new keys.
|
KeyForm |
getKeyFormForUpdate(Id keyId)
Gets the key form for updating an existing key.
|
void |
updateKey(KeyForm keyForm)
Updates a key for an agent.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getAgencyId()
Agency
Id
associated with this
session. Agency Id
associated with this sessionmandatory
- This method must be implemented. Agency getAgency() throws OperationFailedException, PermissionDeniedException
Agency
associated with this session. Agency
associated with this sessionOperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateKeys()
Keys.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Key
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 Key
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateKeyWithRecordTypes(Type[] keyRecordTypes)
Key
using the
desired record interface types. While
AuthenticationKeysManager.getKeyRecordTypes()
can be used to
examine which record interfaces are supported, this method tests which
record(s) are required for creating a specific Key.
Providing an empty array tests if a Key
can be created
with no records.keyRecordTypes
- array of key record types true
if Key
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- keyRecordTypes
is null
mandatory
- This method must be implemented. KeyForm getKeyFormForCreate(Id agentId, Type[] keyRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
agentId
- the Id
of the Agent
keyRecordTypes
- array of key record typesNotFoundException
- agentId
is not foundNullArgumentException
- agentId
or
keyRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Key createKey(KeyForm keyForm) throws OperationFailedException, PermissionDeniedException
Key.
keyForm
- the form for this Key
keyForm
already used in a create transactionIllegalStateException
- agent already has a keyInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- keyForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- keyForm
did not
originate from getKeyFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateKeys()
Keys.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Key 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 key modification is not authorized,
true
otherwisemandatory
- This method must be implemented. KeyForm getKeyFormForUpdate(Id keyId) throws NotFoundException, OperationFailedException, PermissionDeniedException
keyId
- the Id
of the Key
NotFoundException
- keyId
is not foundNullArgumentException
- keyId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateKey(KeyForm keyForm) throws OperationFailedException, PermissionDeniedException
keyForm
- the form containing the elements to be updatedIllegalStateException
- keyForm
already
used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- keyForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- keyForm
did not
originate from getKeyFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteKeys()
Keys.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Key
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 Key
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteKey(Id keyId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Key.
keyId
- the Id
of the Key
NotFoundException
- a Key
was not found
identified by the given Id
NullArgumentException
- keyId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.