public interface AccessControl
Modifier and Type | Method and Description |
---|---|
void |
assignToWorkspace(DMXObject object,
long workspaceId)
Performs the initial workspace assignment for an object.
|
void |
changePassword(Credentials cred)
Changes the password of an existing user account.
|
Topic |
checkCredentials(Credentials cred)
Checks if the given credentials are valid.
|
void |
deleteAssociationMapcontext(Association assoc) |
boolean |
emailAddressExists(String emailAddress)
Returns true if an "Email Address" (dmx.contacts.email_address) topic with the given value exists,
false otherwise.
|
long |
getAdministrationWorkspaceId()
Returns the ID of the "Administration" workspace.
|
long |
getAssignedWorkspaceId(long objectId)
Returns the ID of the workspace a topic or association is assigned to.
|
RelatedTopic |
getConfigTopic(String configTypeUri,
long topicId)
Returns the configuration topic of the given type for the given topic.
|
String |
getCreator(long objectId)
Returns the creator of a topic or an association.
|
long |
getDMXWorkspaceId()
Returns the ID of the "DMX" workspace.
|
String |
getEmailAddress(String username)
Returns the email address for the given username.
|
Topic |
getPrivateWorkspace(String username)
Returns the private workspace of the given user.
|
long |
getSystemWorkspaceId()
Returns the ID of the "System" workspace.
|
String |
getUsername(javax.servlet.http.HttpServletRequest request)
Returns the username that is associated with a request.
|
String |
getUsername(String emailAddress)
Returns the username for the given email address.
|
Topic |
getUsernameTopic(javax.servlet.http.HttpServletRequest request)
Convenience method that returns the Username topic that corresponds to a request.
|
Topic |
getUsernameTopic(String username)
Returns the Username topic that corresponds to a username.
|
Topic |
getWorkspace(String uri)
Returns a workspace by URI.
|
boolean |
hasPermission(String username,
Operation operation,
long objectId)
Checks if a user is permitted to perform an operation on an object (topic or association).
|
boolean |
hasReadPermission(String username,
long workspaceId) |
boolean |
hasWritePermission(String username,
long workspaceId) |
boolean |
isMember(String username,
long workspaceId)
Checks if a user is a member of a given workspace.
|
boolean |
isWorkspaceAssignment(Association assoc)
Checks if an association represents a workspace assignment.
|
<V> V |
runWithoutWorkspaceAssignment(Callable<V> callable)
Runs a code block while suppressing the standard workspace assignment for all topics/associations
created within that code block.
|
String |
username(javax.servlet.http.HttpSession session)
Returns the username that is associated with a session.
|
boolean |
workspaceAssignmentIsSuppressed()
Returns true if standard workspace assignment is currently suppressed for the current thread.
|
boolean hasPermission(String username, Operation operation, long objectId)
username
- the logged in user, or null
if no user is logged in.objectId
- a topic ID, or an association ID.true
if permission is granted, false
otherwise.boolean hasReadPermission(String username, long workspaceId)
boolean hasWritePermission(String username, long workspaceId)
Topic checkCredentials(Credentials cred)
null
otherwise.void changePassword(Credentials cred)
This is a privileged method: it works also if the respective user is not logged in.
cred
- the username and new password.
An user account with the given username must exist. (The username can't be changed.)Topic getUsernameTopic(String username)
null
if no such Username topic exists.Topic getPrivateWorkspace(String username)
Note: a user can have more than one private workspace. This method returns only the first one.
This is a privileged method, it bypasses the access control system.
RuntimeException
- if the user has no private workspace.boolean isMember(String username, long workspaceId)
username
- the logged in user, or null
if no user is logged in.String getCreator(long objectId)
null
if no creator is set.String getUsername(javax.servlet.http.HttpServletRequest request)
null
if no user is associated with the request.Topic getUsernameTopic(javax.servlet.http.HttpServletRequest request)
getUsernameTopic(getUsername(request))
.null
if no user is associated with the request.String username(javax.servlet.http.HttpSession session)
null
if no user is associated with the session.Topic getWorkspace(String uri)
This is a privileged method: it works also if the current user has no READ permission for the workspace.
RuntimeException
- If no workspace exists for the given URI.long getDMXWorkspaceId()
long getAdministrationWorkspaceId()
long getSystemWorkspaceId()
long getAssignedWorkspaceId(long objectId)
objectId
- a topic ID, or an association ID-1
if no workspace is assigned.void assignToWorkspace(DMXObject object, long workspaceId)
Use this method only for objects which have no workspace assignment already, that is e.g. objects created in a migration or objects created while workspace assignment is deliberately suppressed.
boolean isWorkspaceAssignment(Association assoc)
This is a privileged method: it works also if the current user has no READ permission for the potential workspace.
<V> V runWithoutWorkspaceAssignment(Callable<V> callable) throws Exception
Exception
boolean workspaceAssignmentIsSuppressed()
void deleteAssociationMapcontext(Association assoc)
RelatedTopic getConfigTopic(String configTypeUri, long topicId)
This is a privileged method, it bypasses the access control system.
RuntimeException
- if no such configuration topic exists.String getUsername(String emailAddress)
The username is determined by traversing from the Email Address topic along a
org.deepamehta.signup.user_mailbox
association.
This is a privileged method, it bypasses the access control system.
RuntimeException
- if no such Email Address topic exists in the DB, or
if more than one such Email Address topics exist in the DB, or
if the Email Address topic is not associated to a Username topic.String getEmailAddress(String username)
The email address is determined by traversing from the Username topic along a
org.deepamehta.signup.user_mailbox
association.
This is a privileged method, it bypasses the access control system.
RuntimeException
- if no such Username topic exists in the DB, or
if the Username topic is not associated to an Email Address topic.boolean emailAddressExists(String emailAddress)
This is a privileged method, it bypasses the access control system.
Copyright © 2018. All Rights Reserved.