org.eclipse.emf.emfstore.internal.server.accesscontrol
Class DefaultESAuthorizationService

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.server.accesscontrol.DefaultESAuthorizationService
All Implemented Interfaces:
ESAuthorizationService

public class DefaultESAuthorizationService
extends Object
implements ESAuthorizationService

Default implementation of the ESAuthorizationService.

Author:
emueller

Constructor Summary
DefaultESAuthorizationService()
           
 
Method Summary
 void checkAccess(ESMethodInvocation op)
          Checks whether a given operation may be executed.
 boolean checkProjectAdminAccess(ESSessionId sessionId, ESGlobalProjectId globalProjectId)
          Check if the session is valid for admin access to the given project.
 boolean checkProjectAdminAccess(ESSessionId sessionId, ESGlobalProjectId globalProjectId, ESProjectAdminPrivileges privileg)
          Check if the session is valid for admin access to the given project.
 boolean checkProjectAdminAccessForOrgUnit(ESSessionId sessionId, ESOrgUnitId orgUnitId)
          Check if the session is valid for admin access to the given organizational unit.
 boolean checkProjectAdminAccessForOrgUnit(ESSessionId sessionId, ESOrgUnitId orgUnitId, Set<ESGlobalProjectId> projectIds)
          Check if the session is valid for admin access to the given organizational unit.
 void checkReadAccess(ESSessionId sessionId, ESGlobalProjectId globalProjectId, Set<org.eclipse.emf.ecore.EObject> modelElements)
          Check if the session may read the given model elements in the project.
 void checkServerAdminAccess(ESSessionId sessionId)
          Check if the session is valid for server admin access.
 void checkWriteAccess(ESSessionId sessionId, ESGlobalProjectId globalProjectId, Set<org.eclipse.emf.ecore.EObject> modelElements)
          Check if the session may write the given model elements in the project.
 void init(ESSessions sessions, ESOrgUnitResolver orgUnitResolverServive, ESOrgUnitProvider orgUnitProvider)
          Initializes this service.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultESAuthorizationService

public DefaultESAuthorizationService()
Method Detail

checkProjectAdminAccess

public boolean checkProjectAdminAccess(ESSessionId sessionId,
                                       ESGlobalProjectId globalProjectId)
                                throws AccessControlException
Check if the session is valid for admin access to the given project.

Specified by:
checkProjectAdminAccess in interface ESAuthorizationService
Parameters:
sessionId - the session id
globalProjectId - the project id. May be null
Returns:
true, if permission is granted via the server admin role, false otherwise
Throws:
AccessControlException - if the session is invalid for admin access
See Also:
ESAuthorizationService.checkProjectAdminAccess(org.eclipse.emf.emfstore.server.model.ESSessionId, org.eclipse.emf.emfstore.server.model.ESGlobalProjectId)

checkServerAdminAccess

public void checkServerAdminAccess(ESSessionId sessionId)
                            throws AccessControlException
Check if the session is valid for server admin access.

Specified by:
checkServerAdminAccess in interface ESAuthorizationService
Parameters:
sessionId - the session id
Throws:
AccessControlException - if the session is invalid for server admin access
See Also:
ESAuthorizationService.checkServerAdminAccess(org.eclipse.emf.emfstore.server.model.ESSessionId)

checkProjectAdminAccessForOrgUnit

public boolean checkProjectAdminAccessForOrgUnit(ESSessionId sessionId,
                                                 ESOrgUnitId orgUnitId)
                                          throws AccessControlException
Check if the session is valid for admin access to the given organizational unit.

Specified by:
checkProjectAdminAccessForOrgUnit in interface ESAuthorizationService
Parameters:
sessionId - the session id
orgUnitId - the ID of an organizational unit
Returns:
true, if permission is granted via the server admin role, false otherwise
Throws:
AccessControlException - if the session is invalid for admin access
See Also:
ESAuthorizationService.checkProjectAdminAccessForOrgUnit(org.eclipse.emf.emfstore.server.model.ESSessionId, org.eclipse.emf.emfstore.server.model.ESOrgUnitId)

checkProjectAdminAccessForOrgUnit

public boolean checkProjectAdminAccessForOrgUnit(ESSessionId sessionId,
                                                 ESOrgUnitId orgUnitId,
                                                 Set<ESGlobalProjectId> projectIds)
                                          throws AccessControlException
Check if the session is valid for admin access to the given organizational unit.

Specified by:
checkProjectAdminAccessForOrgUnit in interface ESAuthorizationService
Parameters:
sessionId - the session id
orgUnitId - the ID of an organizational unit
projectIds - the set of ESGlobalProjectIds for which to check access for
Returns:
true, if permission is granted via the server admin role, false otherwise
Throws:
AccessControlException - if the session is invalid for admin access
See Also:
ESAuthorizationService.checkProjectAdminAccessForOrgUnit(org.eclipse.emf.emfstore.server.model.ESSessionId, org.eclipse.emf.emfstore.server.model.ESOrgUnitId, java.util.Set)

checkProjectAdminAccess

public boolean checkProjectAdminAccess(ESSessionId sessionId,
                                       ESGlobalProjectId globalProjectId,
                                       ESProjectAdminPrivileges privileg)
                                throws AccessControlException
Check if the session is valid for admin access to the given project.

Specified by:
checkProjectAdminAccess in interface ESAuthorizationService
Parameters:
sessionId - the session id
globalProjectId - the project id. May be null
privileg - the ESProjectAdminPrivileges to be checked
Returns:
true, if permission is granted via the server admin role, false otherwise
Throws:
AccessControlException - if the session is invalid for admin access
See Also:
ESAuthorizationService.checkProjectAdminAccess(org.eclipse.emf.emfstore.server.model.ESSessionId, org.eclipse.emf.emfstore.server.model.ESGlobalProjectId, org.eclipse.emf.emfstore.server.auth.ESProjectAdminPrivileges)

checkReadAccess

public void checkReadAccess(ESSessionId sessionId,
                            ESGlobalProjectId globalProjectId,
                            Set<org.eclipse.emf.ecore.EObject> modelElements)
                     throws AccessControlException
Check if the session may read the given model elements in the project.

Specified by:
checkReadAccess in interface ESAuthorizationService
Parameters:
sessionId - session id
globalProjectId - project id
modelElements - a set of model elements
Throws:
AccessControlException - if the session may not read any of the model elements
See Also:
ESAuthorizationService.checkReadAccess(org.eclipse.emf.emfstore.server.model.ESSessionId, org.eclipse.emf.emfstore.server.model.ESGlobalProjectId, java.util.Set)

checkWriteAccess

public void checkWriteAccess(ESSessionId sessionId,
                             ESGlobalProjectId globalProjectId,
                             Set<org.eclipse.emf.ecore.EObject> modelElements)
                      throws AccessControlException
Check if the session may write the given model elements in the project.

Specified by:
checkWriteAccess in interface ESAuthorizationService
Parameters:
sessionId - session id
globalProjectId - project id
modelElements - a set of model elements
Throws:
AccessControlException - if the session may not write any of the model elements
See Also:
ESAuthorizationService.checkWriteAccess(org.eclipse.emf.emfstore.server.model.ESSessionId, org.eclipse.emf.emfstore.server.model.ESGlobalProjectId, java.util.Set)

checkAccess

public void checkAccess(ESMethodInvocation op)
                 throws AccessControlException
Checks whether a given operation may be executed.

Specified by:
checkAccess in interface ESAuthorizationService
Parameters:
op - the method the user intends to execute
Throws:
AccessControlException - in case access is denied
See Also:
ESAuthorizationService.checkAccess(org.eclipse.emf.emfstore.server.auth.ESMethodInvocation)

init

public void init(ESSessions sessions,
                 ESOrgUnitResolver orgUnitResolverServive,
                 ESOrgUnitProvider orgUnitProvider)
Initializes this service.

Specified by:
init in interface ESAuthorizationService
Parameters:
sessions - the ESSessions object for session handling
orgUnitResolverServive - the ESOrgUnitResolver for resolving organizational units
orgUnitProvider - the ESOrgUnitProvider for obtaining organizational units
See Also:
ESAuthorizationService.init(org.eclipse.emf.emfstore.server.auth.ESSessions, org.eclipse.emf.emfstore.server.auth.ESOrgUnitResolver, org.eclipse.emf.emfstore.server.model.ESOrgUnitProvider)


Copyright © 2016. All Rights Reserved.