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.boolean
hasPermission
(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.void
logout()
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.void
setAutoLogoutTimeout
(int timeoutInMinutes, AutoLogoutCallback callback) Sets the auto logout timeout in minutes.void
Update the last action time to now to prevent auto logout.
-
Method Details
-
logout
Description copied from interface:RBACSubject
Logs the user out. If there was an error during the logout aRBACException
is thrown.- Specified by:
logout
in interfaceRBACSubject
- Throws:
RBACException
- if there was an error while logout.
-
hasPermission
Description copied from interface:RBACSubject
Checks 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 aRBACException
is thrown.- Specified by:
hasPermission
in interfaceRBACSubject
- Parameters:
resource
- the name of the resourcepermission
- the name of the permission- Returns:
true
if 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:RBACSubject
Checks 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.RBACException
is thrown in case of an error.- Specified by:
hasPermissions
in 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:RBACSubject
Requests 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 grantedAccessDeniedException
is thrown. If there was an errorRBACException
is thrown.- Specified by:
requestExclusiveAccess
in 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:RBACSubject
Sets 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:
setAutoLogoutTimeout
in 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:RBACSubject
Update the last action time to now to prevent auto logout.- Specified by:
updateLastAction
in interfaceRBACSubject
-
getUserInfo
Description copied from interface:RBACSubject
Get info of logged in RBAC user.- Specified by:
getUserInfo
in interfaceRBACSubject
- Returns:
- info of logged in user or null if the user is not logged in.
-