Package xal.plugin.essrbac
Class DummyRbacSubject
java.lang.Object
xal.plugin.essrbac.DummyRbacSubject
- All Implemented Interfaces:
RBACSubject
Dummy Rbac Subject implements
RBACSubject returning true for all
permissions.- Version:
- 0.1 28 Jul 2015
- Author:
- Blaz Kranjc <blaz.kranjc@cosylab.com>
-
Method Summary
Modifier and TypeMethodDescriptionGet info of logged in RBAC user.booleanhasPermission(String resource, String permission) Checks if the logged in user is granted the permission provided as parameter.hasPermissions(String resource, String... permissions) Checks if the logged in user is granted the permissions provided as parameters.voidlogout()Logs the user out.requestExclusiveAccess(String resource, String permission, int durationInMinutes) Requests exclusive access to the specified permission for the currently logged in user, on the specified resource.voidsetAutoLogoutTimeout(int timeoutInMinutes, AutoLogoutCallback callback) Sets the auto logout timeout in minutes.voidUpdate the last action time to now to prevent auto logout.
-
Method Details
-
logout
Description copied from interface:RBACSubjectLogs the user out. If there was an error during the logout aRBACExceptionis thrown.- Specified by:
logoutin interfaceRBACSubject- Throws:
RBACException- if there was an error while logout.
-
hasPermission
Description copied from interface:RBACSubjectChecks if the logged in user is granted the permission provided as parameter. If the access is granted, method returnstrue, if not it returnsfalse. If there was an error aRBACExceptionis thrown.- Specified by:
hasPermissionin interfaceRBACSubject- Parameters:
resource- the name of the resourcepermission- the name of the permission- Returns:
trueif the user has the specified permission- Throws:
RBACException- if there was an error
-
hasPermissions
public Map<String,Boolean> hasPermissions(String resource, String... permissions) throws AccessDeniedException, RBACException Description copied from interface:RBACSubjectChecks if the logged in user is granted the permissions provided as parameters. Method returns a map of permission-grant pairs. For every permission, which was granted, value true is returned; for every permission, which was denied, value false is returned.RBACExceptionis thrown in case of an error.- Specified by:
hasPermissionsin interfaceRBACSubject- Parameters:
resource- the name of the resourcepermissions- the names of the permission- Returns:
- map of permission name - permission grant pairs.
- Throws:
AccessDeniedException- if the user was logged outRBACException- if token is missing, or if there was an error while reading or connecting to web services.
-
requestExclusiveAccess
public ExclusiveAccess requestExclusiveAccess(String resource, String permission, int durationInMinutes) throws AccessDeniedException, RBACException Description copied from interface:RBACSubjectRequests exclusive access to the specified permission for the currently logged in user, on the specified resource. If the access is granted, method returns ExclusivAccess object. If the access was not grantedAccessDeniedExceptionis thrown. If there was an errorRBACExceptionis thrown.- Specified by:
requestExclusiveAccessin interfaceRBACSubject- Parameters:
resource- name of the resourcepermission- name of the permissiondurationInMinutes- the duration of exclusive access in minutes, if less than 1 minute, default value will be used (defined by the service)- Returns:
- ExclusiveAccess containing information about the requested permission and the expiration date of the exclusive access, if the request was successful.
- Throws:
AccessDeniedException- if the access was not grantedRBACException- if there was an error
-
setAutoLogoutTimeout
Description copied from interface:RBACSubjectSets the auto logout timeout in minutes. If there was no user activity for the specified duration the facade will notify the user and request confirmation throughAutoLogoutCallback. Based on the response or if there is no response for a specific duration, the user will be logged out.- Specified by:
setAutoLogoutTimeoutin interfaceRBACSubject- Parameters:
timeoutInMinutes- the timeout in minutes after which the user will be logged out if inactivecallback- handler called before subject is logged out
-
updateLastAction
public void updateLastAction()Description copied from interface:RBACSubjectUpdate the last action time to now to prevent auto logout.- Specified by:
updateLastActionin interfaceRBACSubject
-
getUserInfo
Description copied from interface:RBACSubjectGet info of logged in RBAC user.- Specified by:
getUserInfoin interfaceRBACSubject- Returns:
- info of logged in user or null if the user is not logged in.
-