org.kuali.student.common.ui.client.security
Class SecurityContext

java.lang.Object
  extended by org.kuali.student.common.ui.client.security.SecurityContext

public class SecurityContext
extends Object

An interface to access the Kuali Student security context

Author:
Kuali Student Team

Field Summary
private  Map<String,Boolean> permissionCache
           
private  String principalName
           
protected  SecurityRpcServiceAsync securityRpcService
           
 
Constructor Summary
SecurityContext()
           
 
Method Summary
 boolean checkCachedScreenPermission(String screenComponent)
          Used to check a pre-loaded or cached screen permission.
 void checkPermission(String[] permissionNames, Callback<Boolean> checkPermissionCallback)
          Used to check if user has at least one of the permissions listed in the set of permissions passed in
 void checkPermission(String permissionName, Callback<Boolean> checkPermissionCallback)
          Used to check if user has a permission by its permission name.
 boolean checkPermissionCache(String permission)
          Used to check if the permission has been loaded into the cache.
 void checkPermissionNoCache(String permissionName, Callback<Boolean> checkPermissionCallback)
          Used to check if user has the permission with given permissionName without being cached.
 void checkScreenPermission(String screenComponent, Callback<Boolean> checkPermissionCallback)
          Used to check if user has a screen permission.
 String getUserId()
           
 void initializeSecurityContext(Callback<Boolean> contextIntializedCallback)
           
 void loadPermissionsByPermissionType(PermissionType permissionType)
          Loads into the permission cache all the permissions user has for a permission type.
 void loadScreenPermissions(ArrayList<String> screenComponents, Callback<Boolean> loadPermissionsCallback)
          Loads into the permission cache all the permissions user has for a permission type.
 void setPrincipalName(String principalName)
          Set principalName of the user logged in (eg.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

securityRpcService

protected SecurityRpcServiceAsync securityRpcService

principalName

private String principalName

permissionCache

private Map<String,Boolean> permissionCache
Constructor Detail

SecurityContext

public SecurityContext()
Method Detail

initializeSecurityContext

public void initializeSecurityContext(Callback<Boolean> contextIntializedCallback)

setPrincipalName

public void setPrincipalName(String principalName)
Set principalName of the user logged in (eg. jDoe)

Parameters:
principalId -

getUserId

public String getUserId()
Returns:
the userId of user logged into the system. (NOTE: When using KIM userId=principalName)

checkPermissionCache

public boolean checkPermissionCache(String permission)
Used to check if the permission has been loaded into the cache.

Returns:
true if permission exists in cache

checkScreenPermission

public void checkScreenPermission(String screenComponent,
                                  Callback<Boolean> checkPermissionCallback)
Used to check if user has a screen permission. If the permission has been cached in the browser, it will use the cached permission.

Parameters:
screenComponent -

checkCachedScreenPermission

public boolean checkCachedScreenPermission(String screenComponent)
Used to check a pre-loaded or cached screen permission. Note: This should only be called if the permission has been loaded via the loadScreenPermissions method.

Parameters:
screenComponent -
Returns:
true if user has access to the screen component

checkPermission

public void checkPermission(String permissionName,
                            Callback<Boolean> checkPermissionCallback)
Used to check if user has a permission by its permission name. If the permission has been cached in the browser, it will use the cached permission.

Parameters:
permissionName -

checkPermission

public void checkPermission(String[] permissionNames,
                            Callback<Boolean> checkPermissionCallback)
Used to check if user has at least one of the permissions listed in the set of permissions passed in

Parameters:
permissionNames - list of permission names to check

checkPermissionNoCache

public void checkPermissionNoCache(String permissionName,
                                   Callback<Boolean> checkPermissionCallback)
Used to check if user has the permission with given permissionName without being cached. This is useful if the permission is a derived permission and needs to be re-checked each time.

Parameters:
permissionName -

loadPermissionsByPermissionType

public void loadPermissionsByPermissionType(PermissionType permissionType)
Loads into the permission cache all the permissions user has for a permission type.


loadScreenPermissions

public void loadScreenPermissions(ArrayList<String> screenComponents,
                                  Callback<Boolean> loadPermissionsCallback)
Loads into the permission cache all the permissions user has for a permission type.



Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.