Package systems.dmx.accesscontrol
Interface AccessControlService
-
- All Known Implementing Classes:
AccessControlPlugin
public interface AccessControlService
-
-
Field Summary
Fields Modifier and Type Field Description static String
ADMIN_INITIAL_PASSWORD
static String
ADMIN_USERNAME
static String
ADMIN_WORKSPACE_NAME
static SharingMode
ADMIN_WORKSPACE_SHARING_MODE
static String
ADMIN_WORKSPACE_URI
static String
DEFAULT_PRIVATE_WORKSPACE_NAME
static String
SYSTEM_WORKSPACE_NAME
static SharingMode
SYSTEM_WORKSPACE_SHARING_MODE
static String
SYSTEM_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)
void
checkAdmin()
Checks if the current user is a DMX admin and throws AccessControlException if not.void
createMembership(String username, long workspaceId)
Makes the given user a member of the given workspace.Topic
createUserAccount(Credentials cred)
Deprecated.Topic
createUsername(String username)
Deprecated.void
enrichWithOwnerInfo(Topic workspace)
Retrieves the OWNER and stores it in the given topic's model (under synthetic child type URIdmx.accesscontrol.owner
).void
enrichWithUserInfo(DMXObject object)
Retrieves the CREATOR/MODIFIER usernames and stores them in the given object's model (under synthetic child type URIsdmx.accesscontrol.creator
anddmx.accesscontrol.modifier
).long
getAdminWorkspaceId()
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)
.String
getCreator(long objectId)
Returns the creator of a topic or an association.Assoc
getMembership(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.String
getModifier(long objectId)
Returns the modifier of a topic or an association.Permissions
getPermissions(long objectId)
Topic
getPrivateWorkspace()
Returns the private workspace of the logged in user.Collection<Topic>
getTopicsByCreator(String username)
String
getUsername()
Returns the username of the logged in user.Topic
getUsernameTopic()
Returns the "Username" topic of the logged in user.Topic
getUsernameTopic(String username)
Returns the "Username" topic for the specified username (case-insensitive).String
getWorkspaceOwner(long workspaceId)
Returns the owner of a workspace.Collection<Topic>
getWorkspacesByOwner(String username)
boolean
isMember(String username, long workspaceId)
Checks if a user is a member of the given workspace.void
login()
Checks whether the credentials in the authorization string match an existing User Account, and if so, creates an HTTP session.void
logout()
Logs the user out.void
registerAuthorizationMethod(String name, AuthorizationMethod am)
Registers an authorization method under the given name, e.g.void
setWorkspaceOwner(Topic workspace, String username)
Sets the owner of a workspace.void
unregisterAuthorizationMethod(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
null
if 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
), ornull
if 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
), ornull
if no such username exists.
-
getWorkspaceOwner
String getWorkspaceOwner(long workspaceId)
Returns the owner of a workspace.- Returns:
- The username of the owner, or
null
if 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. Ifnull
is passed,false
is returned. If an unknown username is passed an exception is thrown.workspaceId
- the workspace.- Returns:
true
if the user is a member,false
otherwise.
-
getMembership
Assoc getMembership(String username, long workspaceId)
- Returns:
- the Membership assoc between the given username and workspace, or
null
if 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
null
if 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
null
if 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.creator
anddmx.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.
-
-