public class AuthenticationManager
extends java.lang.Object
AuthenticationManager authenticationManager = AuthenticationManager.getAuthenticationManager(cumulusServer); if (authenticationManager.isSimpleMode) { System.out.println ("No roles available because user system is running in simple mode."); } else { String[] roles = authenticationManager.getRoleNamesAsArray(); System.out.println ("Roles available:"); for (int i = 0; i < roles.length; i++) { String role = roles[i]; System.out.println ("found Role = " + role); } } String[] users = authenticationManager.getUserNamesAsArray(); System.out.println ("Users available:"); for (int i = 0; i < users.length; i++) { String user = users[i]; System.out.println ("found User = " + user); }
Modifier and Type | Class and Description |
---|---|
static class |
AuthenticationManager.Department
This class describes a single department and provides access to the child departments.
|
static class |
AuthenticationManager.ServerSettings
This class enables accessing some configuration specifics of the server this authentication manager is connected to.
|
static class |
AuthenticationManager.UserType |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TABLE_PERMISSION_SEPARATOR |
Modifier and Type | Method and Description |
---|---|
void |
addAuthenticatorListener(AuthenticatorListener<AuthenticationManager> listener)
Adds a listener for authentication events.
|
static java.lang.String |
buildTablePermission(java.lang.String tableName,
boolean forSubTables,
java.lang.String permission)
Create a permission string for a specific table.
|
void |
clearFieldDefinitionCache()
Clears the field definition cache which is populated with the first access to
getFieldDefinition(com.canto.cumulus.GUID) . |
ExternalUser |
createExternalUser(java.lang.String loginName,
java.lang.String emailAddress)
Creates a new external user.
|
UserFieldDefinition |
createFieldDefinition(java.lang.String sName,
int type)
Creates a new field definition.
|
OpenCatalogClientGroup |
createOpenCatalogClientGroup(java.lang.String name)
Creates a new Open Catalog Client Group.
|
Role |
createRole(java.lang.String sRoleName)
Create a new Role.
|
User |
createUser(java.lang.String sUserName)
Create a new user.
|
void |
deleteFieldDefinition(GUID guid)
Deletes a field definition.
|
void |
deleteOpenCatalogClientGroup(java.lang.String name)
Delete the specified group at the server.
|
void |
deleteRole(java.lang.String sRoleName)
Delete an existing role.
|
void |
deleteUser(java.lang.String sUserName)
Delete an existing user
|
OpenCatalogClientGroup |
duplicate(java.lang.String newName,
OpenCatalogClientGroup clientGroup)
Duplicates the given group using the specified name as the name of the copy.
|
Role |
duplicateRole(java.lang.String sOldName,
java.lang.String newName)
Duplicates the specified role as a new role.
|
User |
duplicateUser(java.lang.String sOldName,
java.lang.String newName)
Duplicates the specified user as a new user.
|
Users |
findUsers(java.lang.String searchToken)
Returns the found users for the given search token.
|
Users |
findUsers(java.lang.String searchToken,
boolean activeUsersOnly)
Returns the found users for the given search token.
|
static AuthenticationManager |
getAuthenticationManager(Server server)
Get the authentication manager for the specified server instance.
|
ProductList |
getAvailableProductList()
Returns the available products of the server.
|
CumulusSession |
getCumulusSession()
Returns the CumulusSession object.
|
java.util.Map<java.lang.Integer,java.lang.String> |
getDepartmentIDs()
Returns a map of all department ids pointing to their name.
|
AuthenticationManager.Department |
getDepartments()
Returns the configured departments if the feature is enabled for the server.
|
UserFieldDefinition |
getFieldDefinition(GUID guid)
Returns a field definition by GUID from the global field definition cache.
|
GUID[] |
getFieldDefinitionGUIDsAsArray()
Returns an array containing the field GUIDs.
|
UserFieldDefinition[] |
getFieldDefinitions()
Returns all field definitions available at the server for user management (those fields are part of the $Users catalog).
|
boolean |
getHasFeature(Feature feature)
Check whether a given feature is available.
|
OpenCatalogClientGroup |
getOpenCatalogClientGroup(java.lang.String name)
Returns the group instance for the specified name.
|
java.util.List<java.lang.String> |
getOpenCatalogClientGroupNames()
Get a list of names of all existing groups.
|
Role |
getRole(java.lang.String sRole)
Returns a role by name.
|
java.lang.String[] |
getRoleNamesAsArray()
Returns an array containing the list of roles.
|
Server |
getServer()
Returns the server of this connection.
|
AuthenticationManager.ServerSettings |
getServerSettings()
Returns the
AuthenticationManager.ServerSettings which provide additional information about the server. |
java.util.List<User> |
getStrippedUsers(AuthenticationManager.UserType userType,
GUID[] guids)
Returns a list of
User objects which only contain the information for the specified list of fields. |
java.util.List<User> |
getStrippedUsers(GUID[] guids)
Returns a list of
User objects which only contain the information for the specified list of fields. |
User |
getUser(java.lang.String sUser)
Returns a user by name.
|
java.lang.String[] |
getUserNamesAsArray()
Returns an array containing the list of users.
|
java.lang.String[] |
getUserRoleNamesAsArray(java.lang.String sUser)
Returns an array containing the list of roles for a specific user.
|
boolean |
isAdmin()
Return whether you are connected as the Cumulus administrator.
|
boolean |
isSimpleMode()
Returns whether the user management at the server runs in Simple Mode (no support for roles).
|
void |
removeAuthenticatorListener(AuthenticatorListener<AuthenticationManager> listener)
Removes a previously registered listener.
|
void |
renameOpenCatalogClientGroup(java.lang.String oldName,
java.lang.String newName)
Renames the group to the specified new name.
|
void |
renameRole(java.lang.String sRoleName,
java.lang.String sNewRoleName)
Renames a role.
|
void |
saveFieldDefinition(UserFieldDefinition field)
Save the changes for the field definition back to the server.
|
void |
saveOpenCatalogClientGroup(OpenCatalogClientGroup clientGroup)
Save all changes for the group back to the server.
|
void |
saveRole(Role role)
Save the changes for the specified role back to the server.
|
void |
saveUser(User user)
Save the changes for the specified user back to the server.
|
void |
setAdvancedMode()
Calling this function switches the server to Advanced Mode if this feature is available at the server.
|
void |
setDepartments(AuthenticationManager.Department department)
Saves all departments.
|
void |
setUserSettings(java.lang.String sourceUserUID,
java.lang.String[] targetUserUIDs)
Copies the Cumulus application user settings from the source user to all provided target users.
|
boolean |
supportsDepartments()
Returns whether the connected server supports departments.
|
public static final java.lang.String TABLE_PERMISSION_SEPARATOR
public static AuthenticationManager getAuthenticationManager(Server server) throws CumulusException
server
- the server to work withCumulusException
- in case of an errorpublic CumulusSession getCumulusSession()
public GUID[] getFieldDefinitionGUIDsAsArray() throws CumulusException
CumulusException
- in case of an errorpublic java.lang.String[] getUserNamesAsArray() throws CumulusException
CumulusException
- in case of an errorpublic java.lang.String[] getRoleNamesAsArray() throws CumulusException
CumulusException
- in case of an errorpublic java.lang.String[] getUserRoleNamesAsArray(java.lang.String sUser) throws CumulusException
sUser
- the user name.CumulusException
- in case of an errorpublic java.util.List<User> getStrippedUsers(GUID[] guids) throws CumulusException
User
objects which only contain the information for the specified list of fields.guids
- the list of field guids to get the information forUser
objectsCumulusException
- in case of an errorpublic java.util.List<User> getStrippedUsers(AuthenticationManager.UserType userType, GUID[] guids) throws CumulusException
User
objects which only contain the information for the specified list of fields.userType
- type of users to getguids
- the list of field guids to get the information forUser
objectsCumulusException
- in case of an errorpublic AuthenticationManager.ServerSettings getServerSettings() throws CumulusException
AuthenticationManager.ServerSettings
which provide additional information about the server.CumulusException
- in case of an errorpublic UserFieldDefinition[] getFieldDefinitions() throws CumulusException
CumulusException
- in case of an errorpublic UserFieldDefinition getFieldDefinition(GUID guid) throws CumulusException
clearFieldDefinitionCache()
.guid
- the field GUID.CumulusException
- in case of an errorpublic void clearFieldDefinitionCache()
getFieldDefinition(com.canto.cumulus.GUID)
.public UserFieldDefinition createFieldDefinition(java.lang.String sName, int type) throws CumulusException
sName
- the field name.type
- the field type.CumulusException
- in case of an errorpublic void deleteFieldDefinition(GUID guid) throws CumulusException
guid
- the field guid.CumulusException
- in case of an errorpublic User getUser(java.lang.String sUser) throws CumulusException
sUser
- the user name.CumulusException
- in case of an errorpublic User createUser(java.lang.String sUserName) throws CumulusException
sUserName
- The name of the new user to create.CumulusException
- in case the user name exists already or something went wrongpublic void deleteUser(java.lang.String sUserName) throws CumulusException
sUserName
- the user to deleteCumulusException
- in case the user name does not exists.public Role getRole(java.lang.String sRole) throws CumulusException
sRole
- the role name.CumulusException
- in case of an errorpublic Role createRole(java.lang.String sRoleName) throws CumulusException
sRoleName
- the new role name.CumulusException
- in case the name exists already or something went wrongpublic void renameRole(java.lang.String sRoleName, java.lang.String sNewRoleName) throws CumulusException
sRoleName
- the old role namesNewRoleName
- the new role nameCumulusException
- in case the name exists already or something went wrongpublic void deleteRole(java.lang.String sRoleName) throws CumulusException
sRoleName
- the role nameCumulusException
- in case the role name does not exists.public boolean isAdmin() throws CumulusException
CumulusException
- in case of an errorpublic boolean isSimpleMode() throws CumulusException
CumulusException
- in case of an errorpublic void setAdvancedMode() throws CumulusException
CumulusException
- in case of an errorpublic void saveRole(Role role) throws CumulusException
role
- the role to saveCumulusException
- in case of an errorpublic void saveUser(User user) throws CumulusException
user
- the user to save.CumulusException
- in case of an errorpublic void saveFieldDefinition(UserFieldDefinition field) throws CumulusException
field
- the field to saveCumulusException
- in case of an errorpublic ProductList getAvailableProductList() throws CumulusException
CumulusException
- in case of an errorpublic OpenCatalogClientGroup createOpenCatalogClientGroup(java.lang.String name) throws CumulusException
name
- name of the new groupCumulusException
- in case of an errorpublic OpenCatalogClientGroup duplicate(java.lang.String newName, OpenCatalogClientGroup clientGroup) throws CumulusException
newName
- name of the group to createclientGroup
- source group for the group to createCumulusException
- in case of an errorpublic void renameOpenCatalogClientGroup(java.lang.String oldName, java.lang.String newName) throws CumulusException
oldName
- old name of the group.newName
- new name of the group.CumulusException
- in case of an errorpublic void saveOpenCatalogClientGroup(OpenCatalogClientGroup clientGroup) throws CumulusException
clientGroup
- the group to saveCumulusException
- in case of an errorpublic void deleteOpenCatalogClientGroup(java.lang.String name) throws CumulusException
name
- the name of the group to deleteCumulusException
- in case of an errorpublic java.util.List<java.lang.String> getOpenCatalogClientGroupNames() throws CumulusException
CumulusException
- in case of an errorpublic OpenCatalogClientGroup getOpenCatalogClientGroup(java.lang.String name) throws CumulusException
name
- the name of the group to get from the serverCumulusException
- in case of an errorpublic boolean supportsDepartments()
public AuthenticationManager.Department getDepartments() throws CumulusException
CumulusException
- error happenedpublic void setDepartments(AuthenticationManager.Department department) throws CumulusException
department
- root department to saveCumulusException
- error happenedpublic java.util.Map<java.lang.Integer,java.lang.String> getDepartmentIDs() throws CumulusException
CumulusException
- in case of an errorpublic Users findUsers(java.lang.String searchToken)
searchToken
- part of the name to search forpublic Users findUsers(java.lang.String searchToken, boolean activeUsersOnly)
searchToken
- part of the name to search foractiveUsersOnly
- true
if only users with an active account should be returnedpublic ExternalUser createExternalUser(java.lang.String loginName, java.lang.String emailAddress)
loginName
- login name of the new external useremailAddress
- email address of the new external userpublic User duplicateUser(java.lang.String sOldName, java.lang.String newName) throws CumulusException
sOldName
- the user being the source for the copynewName
- the new user name being createdCumulusException
- in case of an errorpublic Role duplicateRole(java.lang.String sOldName, java.lang.String newName) throws CumulusException
sOldName
- the role being the source for the copynewName
- the new role nameCumulusException
- in case of an errorpublic Server getServer()
public boolean getHasFeature(Feature feature)
feature
- the feature to check. Use one of the constants of the Feature
enum.true
if the feature is available, false
otherwise.public void setUserSettings(java.lang.String sourceUserUID, java.lang.String[] targetUserUIDs)
sourceUserUID
- user uid of the source user providing the user settings to write to userstargetUserUIDs
- array of user UIDs specifying the users which should get the preferences of the specified source userpublic void addAuthenticatorListener(AuthenticatorListener<AuthenticationManager> listener)
listener
- new listenerpublic void removeAuthenticatorListener(AuthenticatorListener<AuthenticationManager> listener)
listener
- registered listener to removepublic static java.lang.String buildTablePermission(java.lang.String tableName, boolean forSubTables, java.lang.String permission)
tableName
- table name for the permission to checkforSubTables
- permission should be applied to all sub-tables as wellpermission
- the permission to check on the specified tablewww.canto.com
Canto, the Canto logo, the Cumulus logo, and Cumulus are registered trademarks of Canto GmbH, registered in the U.S. and other countries.