de.deepamehta.core.impl
Class AccessControlImpl

Show UML class diagram
java.lang.Object
  extended by de.deepamehta.core.impl.AccessControlImpl
All Implemented Interfaces:
AccessControl

 class AccessControlImpl
extends Object
implements AccessControl


Field Summary
private  EmbeddedService dms
           
private  Logger logger
           
private static String PROP_OWNER
           
private static String PROP_WORKSPACE_ID
           
private static String SYSTEM_WORKSPACE_URI
           
private  long systemWorkspaceId
           
private static String TYPE_MEMBERSHIP
           
private static String TYPE_USERNAME
           
 
Constructor Summary
AccessControlImpl(EmbeddedService dms)
           
 
Method Summary
private  boolean _hasPermission(String username, Operation operation, long workspaceId)
           
 void assignToWorkspace(DeepaMehtaObject object, long workspaceId)
           
 boolean checkCredentials(Credentials cred)
           
private  long getAssignedWorkspaceId(long objectId)
           
private  String getOwner(long workspaceId)
           
private  String getPassword(TopicModel userAccount)
           
private  SharingMode getSharingMode(long workspaceId)
           
(package private)  long getSystemWorkspaceId()
           
private  String getTypeUri(long objectId)
           
private  TopicModel getUserAccount(TopicModel usernameTopic)
          Prerequisite: usernameTopic is not null.
private  TopicModel getUsernameTopic(String username)
           
private  TopicModel getUsernameTopicOrThrow(String username)
           
 boolean hasPermission(String username, Operation operation, long objectId)
          Checks if a user is permitted to perform an operation on an object (topic or association).
private  boolean hasReadPermission(String username, long workspaceId)
           
private  boolean hasWritePermission(String username, long workspaceId)
           
 boolean isMember(String username, long workspaceId)
          Checks if a user is a member of a given workspace.
private  boolean isOwner(String username, long workspaceId)
          Checks if a user is the owner of a workspace.
private  boolean matches(TopicModel usernameTopic, String password)
          Prerequisite: usernameTopic is not null.
private  String userInfo(String username)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_MEMBERSHIP

private static final String TYPE_MEMBERSHIP
See Also:
Constant Field Values

TYPE_USERNAME

private static final String TYPE_USERNAME
See Also:
Constant Field Values

PROP_OWNER

private static final String PROP_OWNER
See Also:
Constant Field Values

PROP_WORKSPACE_ID

private static final String PROP_WORKSPACE_ID
See Also:
Constant Field Values

SYSTEM_WORKSPACE_URI

private static final String SYSTEM_WORKSPACE_URI
See Also:
Constant Field Values

systemWorkspaceId

private long systemWorkspaceId

dms

private EmbeddedService dms

logger

private Logger logger
Constructor Detail

AccessControlImpl

AccessControlImpl(EmbeddedService dms)
Method Detail

checkCredentials

public boolean checkCredentials(Credentials cred)
Specified by:
checkCredentials in interface AccessControl

hasPermission

public boolean hasPermission(String username,
                             Operation operation,
                             long objectId)
Description copied from interface: AccessControl
Checks if a user is permitted to perform an operation on an object (topic or association).

Specified by:
hasPermission in interface AccessControl
Parameters:
username - the logged in user, or null if no user is logged in.
objectId - a topic ID, or an association ID.
Returns:
true if permission is granted, false otherwise.

isMember

public boolean isMember(String username,
                        long workspaceId)
Description copied from interface: AccessControl
Checks if a user is a member of a given workspace.

Specified by:
isMember in interface AccessControl
Parameters:
username - the logged in user, or null if no user is logged in.

assignToWorkspace

public void assignToWorkspace(DeepaMehtaObject object,
                              long workspaceId)
Specified by:
assignToWorkspace in interface AccessControl

matches

private boolean matches(TopicModel usernameTopic,
                        String password)
Prerequisite: usernameTopic is not null.

Parameters:
password - The encoded password.

getUserAccount

private TopicModel getUserAccount(TopicModel usernameTopic)
Prerequisite: usernameTopic is not null.


getPassword

private String getPassword(TopicModel userAccount)
Returns:
The encoded password of the specified User Account.

_hasPermission

private boolean _hasPermission(String username,
                               Operation operation,
                               long workspaceId)

hasReadPermission

private boolean hasReadPermission(String username,
                                  long workspaceId)
Parameters:
username - the logged in user, or null if no user is logged in.
workspaceId - the ID of the workspace that is relevant for the permission check. Is never -1.

hasWritePermission

private boolean hasWritePermission(String username,
                                   long workspaceId)
Parameters:
username - the logged in user, or null if no user is logged in.
workspaceId - the ID of the workspace that is relevant for the permission check. Is never -1.

getAssignedWorkspaceId

private long getAssignedWorkspaceId(long objectId)

isOwner

private boolean isOwner(String username,
                        long workspaceId)
Checks if a user is the owner of a workspace.

Parameters:
username - the logged in user, or null if no user is logged in.
Returns:
true if the user is the owner, false otherwise.

getSharingMode

private SharingMode getSharingMode(long workspaceId)

getOwner

private String getOwner(long workspaceId)

getTypeUri

private String getTypeUri(long objectId)

getUsernameTopic

private TopicModel getUsernameTopic(String username)

getUsernameTopicOrThrow

private TopicModel getUsernameTopicOrThrow(String username)

getSystemWorkspaceId

long getSystemWorkspaceId()

userInfo

private String userInfo(String username)


Copyright © 2015. All Rights Reserved.