Interface KeyAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
KeyBatchAdminSession
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 .
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can createKeys.booleancanCreateKeyWithRecordTypes(Type[] keyRecordTypes) Tests if this user can create a singleKeyusing the desired record interface types.booleanTests if this user can deleteKeys.booleanTests if this user can updateKeys.Creates a newKey.voidDeletes aKey.Gets theAgencyassociated with this session.Gets theAgencyIdassociated with this session.getKeyFormForCreate(Id agentId, Type[] keyRecordTypes) Gets the key form for creating and updating new keys.getKeyFormForUpdate(Id keyId) Gets the key form for updating an existing key.voidUpdates a key for an agent.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getAgencyId
Id getAgencyId()Gets theAgencyIdassociated with this session.- Returns:
- the
Agency Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getAgency
Gets theAgencyassociated with this session.- Returns:
- the
Agencyassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateKeys
boolean canCreateKeys()Tests if this user can createKeys. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aKeywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifKeycreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateKeyWithRecordTypes
Tests if this user can create a singleKeyusing the desired record interface types. WhileAuthenticationKeysManager.getKeyRecordTypes()can be used to examine which record interfaces are supported, this method tests which record(s) are required for creating a specificKey. Providing an empty array tests if aKeycan be created with no records.- Parameters:
keyRecordTypes- array of key record types- Returns:
trueifKeycreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-keyRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getKeyFormForCreate
KeyForm getKeyFormForCreate(Id agentId, Type[] keyRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the key form for creating and updating new keys. A new form should be requested for each create transaction.- Parameters:
agentId- theIdof theAgentkeyRecordTypes- array of key record types- Returns:
- the key form
- Throws:
NotFoundException-agentIdis not foundNullArgumentException-agentIdorkeyRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createKey
Creates a newKey.- Parameters:
keyForm- the form for thisKey- Returns:
keyFormalready used in a create transaction- Throws:
IllegalStateException- agent already has a keyInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-keyFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-keyFormdid not originate fromgetKeyFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateKeys
boolean canUpdateKeys()Tests if this user can updateKeys. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Key will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseif key modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getKeyFormForUpdate
KeyForm getKeyFormForUpdate(Id keyId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the key form for updating an existing key.- Parameters:
keyId- theIdof theKey- Returns:
- the key form
- Throws:
NotFoundException-keyIdis not foundNullArgumentException-keyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateKey
Updates a key for an agent.- Parameters:
keyForm- the form containing the elements to be updated- Throws:
IllegalStateException-keyFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-keyFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-keyFormdid not originate fromgetKeyFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteKeys
boolean canDeleteKeys()Tests if this user can deleteKeys. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aKeywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifKeydeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteKey
void deleteKey(Id keyId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aKey.- Parameters:
keyId- theIdof theKey- Throws:
NotFoundException- aKeywas not found identified by the givenIdNullArgumentException-keyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-