org.ofbiz.security
Class OFBizSecurity

java.lang.Object
  extended by org.ofbiz.security.Security
      extended by org.ofbiz.security.OFBizSecurity

public class OFBizSecurity
extends Security

OFBizSecurity This class has not been altered from the original source. It now just extends Security and was therefore renamed to OFBizSecurity.


Field Summary
static java.lang.String module
           
static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> simpleRoleEntity
           
 
Fields inherited from class org.ofbiz.security.Security
securityGroupPermissionCache, userLoginSecurityGroupByUserLoginId
 
Constructor Summary
protected OFBizSecurity()
           
protected OFBizSecurity(GenericDelegator delegator)
           
 
Method Summary
 java.util.Iterator<GenericValue> findUserLoginSecurityGroupByUserLoginId(java.lang.String userLoginId)
          Uses userLoginSecurityGroupByUserLoginId cache to speed up the finding of the userLogin's security group list.
 GenericDelegator getDelegator()
           
 boolean hasEntityPermission(java.lang.String entity, java.lang.String action, HttpSession session)
          Like hasPermission above, except it has functionality specific to Entity permissions.
 boolean hasPermission(java.lang.String permission, HttpSession session)
          Checks to see if the currently logged in userLogin has the passed permission.
 boolean hasRolePermission(java.lang.String application, java.lang.String action, java.lang.String entityName, EntityCondition condition, GenericValue userLogin)
          Like hasEntityPermission above, this checks the specified action, as well as for "_ADMIN" to allow for simplified general administration permission, but also checks action_ROLE and validates the user is a member for the application.
 boolean hasRolePermission(java.lang.String application, java.lang.String action, java.lang.String primaryKey, java.util.List<java.lang.String> roles, HttpSession session)
          Like hasEntityPermission above, this checks the specified action, as well as for "_ADMIN" to allow for simplified general administration permission, but also checks action_ROLE and validates the user is a member for the application.
 boolean hasRolePermission(java.lang.String application, java.lang.String action, java.lang.String primaryKey, java.lang.String role, HttpSession session)
          Like hasEntityPermission above, this checks the specified action, as well as for "_ADMIN" to allow for simplified general administration permission, but also checks action_ROLE and validates the user is a member for the application.
 boolean securityGroupPermissionExists(java.lang.String groupId, java.lang.String permission)
          Finds whether or not a SecurityGroupPermission row exists given a groupId and permission.
 void setDelegator(GenericDelegator delegator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

public static final java.lang.String module

simpleRoleEntity

public static final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> simpleRoleEntity
Constructor Detail

OFBizSecurity

protected OFBizSecurity()

OFBizSecurity

protected OFBizSecurity(GenericDelegator delegator)
Method Detail

getDelegator

public GenericDelegator getDelegator()
Overrides:
getDelegator in class Security

setDelegator

public void setDelegator(GenericDelegator delegator)
Overrides:
setDelegator in class Security

findUserLoginSecurityGroupByUserLoginId

public java.util.Iterator<GenericValue> findUserLoginSecurityGroupByUserLoginId(java.lang.String userLoginId)
Description copied from class: Security
Uses userLoginSecurityGroupByUserLoginId cache to speed up the finding of the userLogin's security group list.

Specified by:
findUserLoginSecurityGroupByUserLoginId in class Security
Parameters:
userLoginId - The userLoginId to find security groups by
Returns:
An iterator made from the Collection either cached or retrieved from the database through the UserLoginSecurityGroup Delegator.
See Also:
Security.findUserLoginSecurityGroupByUserLoginId(java.lang.String)

securityGroupPermissionExists

public boolean securityGroupPermissionExists(java.lang.String groupId,
                                             java.lang.String permission)
Description copied from class: Security
Finds whether or not a SecurityGroupPermission row exists given a groupId and permission. Uses the securityGroupPermissionCache to speed this up. The groupId,permission pair is cached instead of the userLoginId,permission pair to keep the cache small and to make it more changeable.

Specified by:
securityGroupPermissionExists in class Security
Parameters:
groupId - The ID of the group
permission - The name of the permission
Returns:
boolean specifying whether or not a SecurityGroupPermission row exists
See Also:
Security.securityGroupPermissionExists(java.lang.String, java.lang.String)

hasPermission

public boolean hasPermission(java.lang.String permission,
                             HttpSession session)
Description copied from class: Security
Checks to see if the currently logged in userLogin has the passed permission.

Specified by:
hasPermission in class Security
Parameters:
permission - Name of the permission to check.
session - The current HTTP session, contains the logged in userLogin as an attribute.
Returns:
Returns true if the currently logged in userLogin has the specified permission, otherwise returns false.
See Also:
org.ofbiz.security.Security#hasPermission(java.lang.String, javax.servlet.http.HttpSession)

hasEntityPermission

public boolean hasEntityPermission(java.lang.String entity,
                                   java.lang.String action,
                                   HttpSession session)
Description copied from class: Security
Like hasPermission above, except it has functionality specific to Entity permissions. Checks the entity for the specified action, as well as for "_ADMIN" to allow for simplified general administration permission.

Specified by:
hasEntityPermission in class Security
Parameters:
entity - The name of the Entity corresponding to the desired permission.
action - The action on the Entity corresponding to the desired permission.
session - The current HTTP session, contains the logged in userLogin as an attribute.
Returns:
Returns true if the currently logged in userLogin has the specified permission, otherwise returns false.
See Also:
org.ofbiz.security.Security#hasEntityPermission(java.lang.String, java.lang.String, javax.servlet.http.HttpSession)

hasRolePermission

public boolean hasRolePermission(java.lang.String application,
                                 java.lang.String action,
                                 java.lang.String primaryKey,
                                 java.lang.String role,
                                 HttpSession session)
Description copied from class: Security
Like hasEntityPermission above, this checks the specified action, as well as for "_ADMIN" to allow for simplified general administration permission, but also checks action_ROLE and validates the user is a member for the application.

Specified by:
hasRolePermission in class Security
Parameters:
application - The name of the application corresponding to the desired permission.
action - The action on the application corresponding to the desired permission.
primaryKey - The primary key for the role check.
role - The roleTypeId which the user must validate with.
session - The current HTTP session, contains the logged in userLogin as an attribute.
Returns:
Returns true if the currently logged in userLogin has the specified permission, otherwise returns false.
See Also:
org.ofbiz.security.Security#hasRolePermission(java.lang.String, java.lang.String, java.lang.String, java.lang.String, javax.servlet.http.HttpSession)

hasRolePermission

public boolean hasRolePermission(java.lang.String application,
                                 java.lang.String action,
                                 java.lang.String primaryKey,
                                 java.util.List<java.lang.String> roles,
                                 HttpSession session)
Description copied from class: Security
Like hasEntityPermission above, this checks the specified action, as well as for "_ADMIN" to allow for simplified general administration permission, but also checks action_ROLE and validates the user is a member for the application.

Specified by:
hasRolePermission in class Security
Parameters:
application - The name of the application corresponding to the desired permission.
action - The action on the application corresponding to the desired permission.
primaryKey - The primary key for the role check.
roles - List of roleTypeId of which the user must validate with (ORed).
session - The current HTTP session, contains the logged in userLogin as an attribute.
Returns:
Returns true if the currently logged in userLogin has the specified permission, otherwise returns false.
See Also:
org.ofbiz.security.Security#hasRolePermission(java.lang.String, java.lang.String, java.lang.String, java.util.List, javax.servlet.http.HttpSession)

hasRolePermission

public boolean hasRolePermission(java.lang.String application,
                                 java.lang.String action,
                                 java.lang.String entityName,
                                 EntityCondition condition,
                                 GenericValue userLogin)
Like hasEntityPermission above, this checks the specified action, as well as for "_ADMIN" to allow for simplified general administration permission, but also checks action_ROLE and validates the user is a member for the application.

Parameters:
application - The name of the application corresponding to the desired permission.
action - The action on the application corresponding to the desired permission.
entityName - The name of the role entity to use for validation.
condition - EntityCondition used to query the entityName.
userLogin - The userLogin object for user to check against.
Returns:
Returns true if the currently logged in userLogin has the specified permission, otherwise returns false.