public class AccessControlPlugin extends systems.dmx.core.osgi.PluginActivator implements AccessControlService, systems.dmx.config.ConfigCustomizer, systems.dmx.core.service.event.CheckTopicReadAccess, systems.dmx.core.service.event.CheckTopicWriteAccess, systems.dmx.core.service.event.CheckAssocReadAccess, systems.dmx.core.service.event.CheckAssocWriteAccess, systems.dmx.core.service.event.PreCreateAssoc, systems.dmx.core.service.event.PreUpdateTopic, systems.dmx.core.service.event.PostCreateTopic, systems.dmx.core.service.event.PostCreateAssoc, systems.dmx.core.service.event.PostUpdateTopic, systems.dmx.core.service.event.PostUpdateAssoc, systems.dmx.core.service.event.ServiceRequestFilter, systems.dmx.core.service.event.StaticResourceFilter, systems.dmx.files.event.CheckDiskQuota
ADMIN_INITIAL_PASSWORD, ADMIN_USERNAME, ADMIN_WORKSPACE_NAME, ADMIN_WORKSPACE_SHARING_MODE, ADMIN_WORKSPACE_URI, DEFAULT_PRIVATE_WORKSPACE_NAME, SYSTEM_WORKSPACE_NAME, SYSTEM_WORKSPACE_SHARING_MODE, SYSTEM_WORKSPACE_URI| Constructor and Description |
|---|
AccessControlPlugin() |
| Modifier and Type | Method and Description |
|---|---|
systems.dmx.core.Topic |
_createUserAccount(systems.dmx.core.service.accesscontrol.Credentials cred)
Creates an user account.
|
List<systems.dmx.core.RelatedTopic> |
bulkUpdateMemberships(long workspaceId,
systems.dmx.core.util.IdList addUserIds,
systems.dmx.core.util.IdList removeUserIds) |
List<systems.dmx.core.RelatedTopic> |
bulkUpdateMemberships(String username,
systems.dmx.core.util.IdList addWorkspaceIds,
systems.dmx.core.util.IdList removeWorkspaceIds) |
void |
checkAdmin()
Checks if the current user is a DMX admin and throws AccessControlException if not.
|
void |
checkAssocReadAccess(long assocId) |
void |
checkAssocWriteAccess(long assocId) |
void |
checkDiskQuota(String username,
long fileSize,
long diskQuota) |
void |
checkTopicReadAccess(long topicId) |
void |
checkTopicWriteAccess(long topicId) |
void |
createMembership(String username,
long workspaceId)
Makes the given user a member of the given workspace.
|
systems.dmx.core.Topic |
createUserAccount(systems.dmx.core.service.accesscontrol.Credentials cred)
Creates an user account.
|
systems.dmx.core.Topic |
createUsername(String username)
Creates a Username topic and a private workspace.
|
void |
enrichWithOwnerInfo(systems.dmx.core.Topic workspace)
Retrieves the OWNER and stores it in the given topic's model (under synthetic child type URI
dmx.accesscontrol.owner). |
void |
enrichWithUserInfo(systems.dmx.core.DMXObject object)
Retrieves the CREATOR/MODIFIER usernames and stores them in the given object's model (under synthetic child type
URIs
dmx.accesscontrol.creator and dmx.accesscontrol.modifier). |
long |
getAdminWorkspaceId() |
Collection<systems.dmx.core.Assoc> |
getAssocsByCreator(String username) |
Collection<systems.dmx.core.Assoc> |
getAssocsByOwner(String username) |
Set<String> |
getAuthorizationMethods()
Returns the names of all authorization methods, as registered by
AccessControlService.registerAuthorizationMethod(java.lang.String, systems.dmx.accesscontrol.AuthorizationMethod). |
systems.dmx.core.model.TopicModel |
getConfigValue(systems.dmx.core.Topic topic) |
String |
getCreator(long objectId)
Returns the creator of a topic or an association.
|
systems.dmx.core.Assoc |
getMembership(String username,
long workspaceId) |
List<systems.dmx.core.RelatedTopic> |
getMemberships(long workspaceId)
Returns the members of the given workspace.
|
List<systems.dmx.core.RelatedTopic> |
getMemberships(String username)
Returns the workspaces of the given user.
|
String |
getModifier(long objectId)
Returns the modifier of a topic or an association.
|
systems.dmx.core.service.accesscontrol.Permissions |
getPermissions(long objectId) |
systems.dmx.core.Topic |
getPrivateWorkspace()
Returns the private workspace of the logged in user.
|
Collection<systems.dmx.core.Topic> |
getTopicsByCreator(String username) |
Collection<systems.dmx.core.Topic> |
getTopicsByOwner(String username) |
String |
getUsername()
Returns the username of the logged in user.
|
systems.dmx.core.Topic |
getUsernameTopic()
Returns the "Username" topic of the logged in user.
|
systems.dmx.core.Topic |
getUsernameTopic(String username)
Returns the "Username" topic for the specified username (case-insensitive).
|
String |
getWorkspaceOwner(long workspaceId)
Returns the owner of a workspace.
|
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 |
postCreateAssoc(systems.dmx.core.Assoc assoc) |
void |
postCreateTopic(systems.dmx.core.Topic topic) |
void |
postUpdateAssoc(systems.dmx.core.Assoc assoc,
systems.dmx.core.service.ChangeReport report,
systems.dmx.core.model.AssocModel updateModel) |
void |
postUpdateTopic(systems.dmx.core.Topic topic,
systems.dmx.core.service.ChangeReport report,
systems.dmx.core.model.TopicModel updateModel) |
void |
preCreateAssoc(systems.dmx.core.model.AssocModel assoc) |
void |
preInstall() |
void |
preUpdateTopic(systems.dmx.core.Topic topic,
systems.dmx.core.model.TopicModel updateModel) |
void |
registerAuthorizationMethod(String name,
AuthorizationMethod am)
Registers an authorization method under the given name, e.g.
|
void |
serviceRequestFilter(com.sun.jersey.spi.container.ContainerRequest containerRequest) |
void |
setWorkspaceOwner(systems.dmx.core.Topic workspace,
String username)
Sets the owner of a workspace.
|
void |
shutdown() |
void |
staticResourceFilter(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse) |
void |
unregisterAuthorizationMethod(String name)
Unregisters the authorization method that has been registered under the given name.
|
public void login()
AccessControlServicelogin in interface AccessControlServicepublic void logout()
AccessControlServicelogout in interface AccessControlServicepublic String getUsername()
AccessControlServicegetUsername in interface AccessControlServicenull if no user is logged in.public systems.dmx.core.Topic getUsernameTopic()
AccessControlServicegetUsernameTopic in interface AccessControlServicedmx.accesscontrol.username),
or null if no user is logged in.public systems.dmx.core.Topic getPrivateWorkspace()
AccessControlServiceNote: a user can have more than one private workspace. This method returns only the first one.
getPrivateWorkspace in interface AccessControlServicepublic void checkAdmin()
AccessControlServicecheckAdmin in interface AccessControlServicepublic systems.dmx.core.Topic createUserAccount(systems.dmx.core.service.accesscontrol.Credentials cred)
AccessControlServicecreateUserAccount in interface AccessControlServicepublic systems.dmx.core.Topic _createUserAccount(systems.dmx.core.service.accesscontrol.Credentials cred)
throws Exception
AccessControlServiceSecurity: this method is not callable from outside as it has no REST interface. So the DMX platform is still secure. On the other hand, a 3rd-party plugin which provides a RESTful interface to this method is required to apply an additional authorization measure, e.g. a short-living access token sent via email.
_createUserAccount in interface AccessControlServiceExceptionpublic systems.dmx.core.Topic createUsername(String username)
AccessControlServicecreateUsername in interface AccessControlServicepublic systems.dmx.core.Topic getUsernameTopic(String username)
AccessControlServicegetUsernameTopic in interface AccessControlServiceusername - a username. Must not be null.dmx.accesscontrol.username),
or null if no such username exists.public String getWorkspaceOwner(long workspaceId)
AccessControlServicegetWorkspaceOwner in interface AccessControlServicenull if no owner is set.public void setWorkspaceOwner(systems.dmx.core.Topic workspace,
String username)
AccessControlServicesetWorkspaceOwner in interface AccessControlServicepublic void enrichWithOwnerInfo(systems.dmx.core.Topic workspace)
AccessControlServicedmx.accesscontrol.owner).enrichWithOwnerInfo in interface AccessControlServicepublic List<systems.dmx.core.RelatedTopic> getMemberships(String username)
AccessControlServicegetMemberships in interface AccessControlServicepublic List<systems.dmx.core.RelatedTopic> getMemberships(long workspaceId)
AccessControlServicegetMemberships in interface AccessControlServicepublic boolean isMember(String username, long workspaceId)
AccessControlServiceisMember in interface AccessControlServiceusername - the user.
If null is passed, false is returned.
If an unknown username is passed an exception is thrown.workspaceId - the workspace.true if the user is a member, false otherwise.public systems.dmx.core.Assoc getMembership(String username, long workspaceId)
getMembership in interface AccessControlServicenull if the
user is not a member.public void createMembership(String username, long workspaceId)
AccessControlServicecreateMembership in interface AccessControlServicepublic List<systems.dmx.core.RelatedTopic> bulkUpdateMemberships(String username, systems.dmx.core.util.IdList addWorkspaceIds, systems.dmx.core.util.IdList removeWorkspaceIds)
bulkUpdateMemberships in interface AccessControlServicepublic List<systems.dmx.core.RelatedTopic> bulkUpdateMemberships(long workspaceId, systems.dmx.core.util.IdList addUserIds, systems.dmx.core.util.IdList removeUserIds)
bulkUpdateMemberships in interface AccessControlServicepublic long getAdminWorkspaceId()
getAdminWorkspaceId in interface AccessControlServicepublic systems.dmx.core.service.accesscontrol.Permissions getPermissions(long objectId)
getPermissions in interface AccessControlServiceobjectId - a topic ID, or an association ID.dmx.accesscontrol.operation.write.public String getCreator(long objectId)
AccessControlServicegetCreator in interface AccessControlServicenull if no creator is set.public String getModifier(long objectId)
AccessControlServicegetModifier in interface AccessControlServicenull if no modifier is set.public void enrichWithUserInfo(systems.dmx.core.DMXObject object)
AccessControlServicedmx.accesscontrol.creator and dmx.accesscontrol.modifier).enrichWithUserInfo in interface AccessControlServicepublic Collection<systems.dmx.core.Topic> getTopicsByCreator(String username)
getTopicsByCreator in interface AccessControlServicepublic Collection<systems.dmx.core.Topic> getTopicsByOwner(String username)
getTopicsByOwner in interface AccessControlServicepublic Collection<systems.dmx.core.Assoc> getAssocsByCreator(String username)
getAssocsByCreator in interface AccessControlServicepublic Collection<systems.dmx.core.Assoc> getAssocsByOwner(String username)
getAssocsByOwner in interface AccessControlServicepublic Set<String> getAuthorizationMethods()
AccessControlServiceAccessControlService.registerAuthorizationMethod(java.lang.String, systems.dmx.accesscontrol.AuthorizationMethod).getAuthorizationMethods in interface AccessControlServiceAccessControlService.registerAuthorizationMethod(java.lang.String, systems.dmx.accesscontrol.AuthorizationMethod), but is an integral part of the DMX platform.public void registerAuthorizationMethod(String name, AuthorizationMethod am)
AccessControlServiceregisterAuthorizationMethod in interface AccessControlServicepublic void unregisterAuthorizationMethod(String name)
AccessControlServiceunregisterAuthorizationMethod in interface AccessControlServicepublic void preInstall()
preInstall in interface systems.dmx.core.osgi.PluginContextpreInstall in class systems.dmx.core.osgi.PluginActivatorpublic void shutdown()
shutdown in interface systems.dmx.core.osgi.PluginContextshutdown in class systems.dmx.core.osgi.PluginActivatorpublic systems.dmx.core.model.TopicModel getConfigValue(systems.dmx.core.Topic topic)
getConfigValue in interface systems.dmx.config.ConfigCustomizerpublic void checkTopicReadAccess(long topicId)
checkTopicReadAccess in interface systems.dmx.core.service.event.CheckTopicReadAccesspublic void checkTopicWriteAccess(long topicId)
checkTopicWriteAccess in interface systems.dmx.core.service.event.CheckTopicWriteAccesspublic void checkAssocReadAccess(long assocId)
checkAssocReadAccess in interface systems.dmx.core.service.event.CheckAssocReadAccesspublic void checkAssocWriteAccess(long assocId)
checkAssocWriteAccess in interface systems.dmx.core.service.event.CheckAssocWriteAccesspublic void postCreateTopic(systems.dmx.core.Topic topic)
postCreateTopic in interface systems.dmx.core.service.event.PostCreateTopicpublic void preCreateAssoc(systems.dmx.core.model.AssocModel assoc)
preCreateAssoc in interface systems.dmx.core.service.event.PreCreateAssocpublic void postCreateAssoc(systems.dmx.core.Assoc assoc)
postCreateAssoc in interface systems.dmx.core.service.event.PostCreateAssocpublic void preUpdateTopic(systems.dmx.core.Topic topic,
systems.dmx.core.model.TopicModel updateModel)
preUpdateTopic in interface systems.dmx.core.service.event.PreUpdateTopicpublic void postUpdateTopic(systems.dmx.core.Topic topic,
systems.dmx.core.service.ChangeReport report,
systems.dmx.core.model.TopicModel updateModel)
postUpdateTopic in interface systems.dmx.core.service.event.PostUpdateTopicpublic void postUpdateAssoc(systems.dmx.core.Assoc assoc,
systems.dmx.core.service.ChangeReport report,
systems.dmx.core.model.AssocModel updateModel)
postUpdateAssoc in interface systems.dmx.core.service.event.PostUpdateAssocpublic void serviceRequestFilter(com.sun.jersey.spi.container.ContainerRequest containerRequest)
serviceRequestFilter in interface systems.dmx.core.service.event.ServiceRequestFilterpublic void staticResourceFilter(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse)
staticResourceFilter in interface systems.dmx.core.service.event.StaticResourceFilterpublic void checkDiskQuota(String username, long fileSize, long diskQuota)
checkDiskQuota in interface systems.dmx.files.event.CheckDiskQuotaCopyright © 2023. All rights reserved.