Package systems.dmx.accesscontrol
Interface AccessControlService
-
- All Known Implementing Classes:
AccessControlPlugin
public interface AccessControlService
-
-
Field Summary
Fields Modifier and Type Field Description static StringADMIN_INITIAL_PASSWORDstatic StringADMIN_USERNAMEstatic StringADMIN_WORKSPACE_NAMEstatic SharingModeADMIN_WORKSPACE_SHARING_MODEstatic StringADMIN_WORKSPACE_URIstatic StringDEFAULT_PRIVATE_WORKSPACE_NAMEstatic StringSYSTEM_WORKSPACE_NAMEstatic SharingModeSYSTEM_WORKSPACE_SHARING_MODEstatic StringSYSTEM_WORKSPACE_URI
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Topic_createUserAccount(Credentials cred)Deprecated.List<RelatedTopic>bulkUpdateMemberships(long workspaceId, IdList addUserIds, IdList removeUserIds)List<RelatedTopic>bulkUpdateMemberships(String username, IdList addWorkspaceIds, IdList removeWorkspaceIds)voidcheckAdmin()Checks if the current user is a DMX admin and throws AccessControlException if not.voidcreateMembership(String username, long workspaceId)Makes the given user a member of the given workspace.TopiccreateUserAccount(Credentials cred)Deprecated.TopiccreateUsername(String username)Deprecated.voidenrichWithOwnerInfo(Topic workspace)Retrieves the OWNER and stores it in the given topic's model (under synthetic child type URIdmx.accesscontrol.owner).voidenrichWithUserInfo(DMXObject object)Retrieves the CREATOR/MODIFIER usernames and stores them in the given object's model (under synthetic child type URIsdmx.accesscontrol.creatoranddmx.accesscontrol.modifier).longgetAdminWorkspaceId()Collection<Assoc>getAssocsByCreator(String username)Set<String>getAuthorizationMethods()Returns the names of all authorization methods, as registered byregisterAuthorizationMethod(java.lang.String, systems.dmx.accesscontrol.AuthorizationMethod).StringgetCreator(long objectId)Returns the creator of a topic or an association.AssocgetMembership(String username, long workspaceId)List<RelatedTopic>getMemberships(long workspaceId)Returns the members of the given workspace.List<RelatedTopic>getMemberships(String username)Returns the workspaces of the given user.StringgetModifier(long objectId)Returns the modifier of a topic or an association.PermissionsgetPermissions(long objectId)TopicgetPrivateWorkspace()Returns the private workspace of the logged in user.Collection<Topic>getTopicsByCreator(String username)StringgetUsername()Returns the username of the logged in user.TopicgetUsernameTopic()Returns the "Username" topic of the logged in user.TopicgetUsernameTopic(String username)Returns the "Username" topic for the specified username (case-insensitive).StringgetWorkspaceOwner(long workspaceId)Returns the owner of a workspace.Collection<Topic>getWorkspacesByOwner(String username)booleanisMember(String username, long workspaceId)Checks if a user is a member of the given workspace.voidlogin()Checks whether the credentials in the authorization string match an existing User Account, and if so, creates an HTTP session.voidlogout()Logs the user out.voidregisterAuthorizationMethod(String name, AuthorizationMethod am)Registers an authorization method under the given name, e.g.voidsetWorkspaceOwner(Topic workspace, String username)Sets the owner of a workspace.voidunregisterAuthorizationMethod(String name)Unregisters the authorization method that has been registered under the given name.
-
-
-
Field Detail
-
ADMIN_USERNAME
static final String ADMIN_USERNAME
- See Also:
- Constant Field Values
-
ADMIN_INITIAL_PASSWORD
static final String ADMIN_INITIAL_PASSWORD
-
ADMIN_WORKSPACE_NAME
static final String ADMIN_WORKSPACE_NAME
- See Also:
- Constant Field Values
-
ADMIN_WORKSPACE_URI
static final String ADMIN_WORKSPACE_URI
- See Also:
- Constant Field Values
-
ADMIN_WORKSPACE_SHARING_MODE
static final SharingMode ADMIN_WORKSPACE_SHARING_MODE
-
SYSTEM_WORKSPACE_NAME
static final String SYSTEM_WORKSPACE_NAME
- See Also:
- Constant Field Values
-
SYSTEM_WORKSPACE_URI
static final String SYSTEM_WORKSPACE_URI
- See Also:
- Constant Field Values
-
SYSTEM_WORKSPACE_SHARING_MODE
static final SharingMode SYSTEM_WORKSPACE_SHARING_MODE
-
DEFAULT_PRIVATE_WORKSPACE_NAME
static final String DEFAULT_PRIVATE_WORKSPACE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
createUserAccount
@Deprecated Topic createUserAccount(Credentials cred)
Deprecated.
-
_createUserAccount
@Deprecated Topic _createUserAccount(Credentials cred) throws Exception
Deprecated.- Throws:
Exception
-
createUsername
@Deprecated Topic createUsername(String username)
Deprecated.
-
login
void login()
Checks whether the credentials in the authorization string match an existing User Account, and if so, creates an HTTP session. ### FIXDOC- Parameters:
authHeader- the authorization string containing the credentials. ### FIXDOC Formatted like a "Authorization" HTTP header value. That is, "Basic " appended by the Base64 encoded form of "{username}:{password}".
-
logout
void logout()
Logs the user out. That is invalidating the session associated with the JSESSION ID cookie. For a "non-private" DM installation the response is 204 No Content. For a "private" DM installation the response is 401 Authorization Required. In this case the webclient is supposed to shutdown the DM GUI then. The webclient of a "private" DM installation must only be visible/usable when logged in.
-
getUsername
String getUsername()
Returns the username of the logged in user.- Returns:
- The username, or
nullif no user is logged in.
-
getUsernameTopic
Topic getUsernameTopic()
Returns the "Username" topic of the logged in user.- Returns:
- The "Username" topic (type
dmx.accesscontrol.username), ornullif no user is logged in.
-
getPrivateWorkspace
Topic getPrivateWorkspace()
Returns the private workspace of the logged in user.Note: a user can have more than one private workspace. This method returns only the first one.
- Returns:
- The logged in user's private workspace (a topic of type "Workspace").
- Throws:
IllegalStateException- if no user is logged in.RuntimeException- if the logged in user has no private workspace.
-
checkAdmin
void checkAdmin()
Checks if the current user is a DMX admin and throws AccessControlException if not. Note: if invoked as "System" no AccessControlException is thrown.- Throws:
AccessControlException- if the current user is not a DMX admin.
-
getUsernameTopic
Topic getUsernameTopic(String username)
Returns the "Username" topic for the specified username (case-insensitive).- Parameters:
username- a username. Must not be null.- Returns:
- The "Username" topic (type
dmx.accesscontrol.username), ornullif no such username exists.
-
getWorkspaceOwner
String getWorkspaceOwner(long workspaceId)
Returns the owner of a workspace.- Returns:
- The username of the owner, or
nullif no owner is set.
-
setWorkspaceOwner
void setWorkspaceOwner(Topic workspace, String username)
Sets the owner of a workspace. ### TODO: should take an ID instead a topic. ### Core service must be extended with a property setter.
-
enrichWithOwnerInfo
void enrichWithOwnerInfo(Topic workspace)
Retrieves the OWNER and stores it in the given topic's model (under synthetic child type URIdmx.accesscontrol.owner).
-
getMemberships
List<RelatedTopic> getMemberships(String username)
Returns the workspaces of the given user.- Returns:
- a list of Workspace topics. The "relating" part is the Membership association.
-
getMemberships
List<RelatedTopic> getMemberships(long workspaceId)
Returns the members of the given workspace.- Returns:
- a list of Username topics. The "relating" part is the Membership association.
-
isMember
boolean isMember(String username, long workspaceId)
Checks if a user is a member of the given workspace.- Parameters:
username- the user. Ifnullis passed,falseis returned. If an unknown username is passed an exception is thrown.workspaceId- the workspace.- Returns:
trueif the user is a member,falseotherwise.
-
getMembership
Assoc getMembership(String username, long workspaceId)
- Returns:
- the Membership assoc between the given username and workspace, or
nullif the user is not a member.
-
createMembership
void createMembership(String username, long workspaceId)
Makes the given user a member of the given workspace.
-
bulkUpdateMemberships
List<RelatedTopic> bulkUpdateMemberships(String username, IdList addWorkspaceIds, IdList removeWorkspaceIds)
- Returns:
- a list of Workspace topics. The "relating" part is the Membership association.
-
bulkUpdateMemberships
List<RelatedTopic> bulkUpdateMemberships(long workspaceId, IdList addUserIds, IdList removeUserIds)
- Returns:
- a list of Username topics. The "relating" part is the Membership association.
-
getAdminWorkspaceId
long getAdminWorkspaceId()
-
getPermissions
Permissions getPermissions(long objectId)
- Parameters:
objectId- a topic ID, or an association ID.- Returns:
- A Permissions object with one entry:
dmx.accesscontrol.operation.write.
-
getCreator
String getCreator(long objectId)
Returns the creator of a topic or an association.- Returns:
- The username of the creator, or
nullif no creator is set.
-
getModifier
String getModifier(long objectId)
Returns the modifier of a topic or an association.- Returns:
- The username of the modifier, or
nullif no modifier is set.
-
enrichWithUserInfo
void enrichWithUserInfo(DMXObject object)
Retrieves the CREATOR/MODIFIER usernames and stores them in the given object's model (under synthetic child type URIsdmx.accesscontrol.creatoranddmx.accesscontrol.modifier).
-
getWorkspacesByOwner
Collection<Topic> getWorkspacesByOwner(String username)
-
getTopicsByCreator
Collection<Topic> getTopicsByCreator(String username)
-
getAssocsByCreator
Collection<Assoc> getAssocsByCreator(String username)
-
getAuthorizationMethods
Set<String> getAuthorizationMethods()
Returns the names of all authorization methods, as registered byregisterAuthorizationMethod(java.lang.String, systems.dmx.accesscontrol.AuthorizationMethod).- Returns:
- the names of all registered authorization methods. Might be empty.
Note: authorization method "BASIC" is not included. This one is not registered by
registerAuthorizationMethod(java.lang.String, systems.dmx.accesscontrol.AuthorizationMethod), but is an integral part of the DMX platform.
-
registerAuthorizationMethod
void registerAuthorizationMethod(String name, AuthorizationMethod am)
Registers an authorization method under the given name, e.g. "LDAP".- Throws:
RuntimeException- if an authorization method is already registered under the given name.
-
unregisterAuthorizationMethod
void unregisterAuthorizationMethod(String name)
Unregisters the authorization method that has been registered under the given name. If no authorization method is registered under that name, nothing happens.
-
-