com.pow2.acl.dao
Class ACLDAO

java.lang.Object
  extended bycom.pow2.dao.AbstractDAO
      extended bycom.pow2.acl.dao.ACLDAO

public class ACLDAO
extends com.pow2.dao.AbstractDAO

Data access object for ACL.

Author:
Luca Fossato

Field Summary
 
Fields inherited from class com.pow2.dao.AbstractDAO
cat
 
Constructor Summary
protected ACLDAO()
          Default protected constructor.
 
Method Summary
 ArrayList getRolePermissions(Role role)
          Get all the permissions for the input role.
 ArrayList getUserGroups(com.pow2.user.User user)
          Get all the groups for the user.
 ArrayList getUserRoles(com.pow2.user.User user)
          Get all the roles for the user.
 ArrayList getUserRoles(com.pow2.user.User user, Group group)
          Get all the roles for the user belonging to the input group.
 boolean hasUserPermission(com.pow2.user.User user, Group group, Permission permission)
          Check if the user belonging to the input group has got the input permission.
 boolean hasUserPermission(com.pow2.user.User user, Permission permission)
          Check if the user has got the input permission.
static ACLDAO instance()
          Get the instance of DAO class.
 boolean isUserInGroup(com.pow2.user.User user, Group group)
          Check if the user belongs to the input group.
 boolean isUserInRole(com.pow2.user.User user, Group group, Role role)
          Check if the user belonging to the input group has got the input role.
 boolean isUserInRole(com.pow2.user.User user, Role role)
          Check if the user has got the input role.
 
Methods inherited from class com.pow2.dao.AbstractDAO
assertion, closeResources, closeResources, closeResources, count, count, delete, delete, enableDebug, encode, getConnection, getConnection, getNewKey, isDebugEnabled, populate, setLike, setLike
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ACLDAO

protected ACLDAO()
Default protected constructor.

Method Detail

instance

public static ACLDAO instance()
Get the instance of DAO class.

Returns:
the instance of DAO class.

isUserInGroup

public boolean isUserInGroup(com.pow2.user.User user,
                             Group group)
                      throws Exception
Check if the user belongs to the input group.

Parameters:
user - the user.
group - the group wich the user should belong to.
Returns:
true if the user belongs to the group, false otherwise.
Throws:
Exception - if the query fails.

isUserInRole

public boolean isUserInRole(com.pow2.user.User user,
                            Role role)
                     throws Exception
Check if the user has got the input role.

Parameters:
user - Description of the Parameter
role - Description of the Parameter
Returns:
true if the user has got the input role, false otherwise.
Throws:
Exception - if the query fails.

isUserInRole

public boolean isUserInRole(com.pow2.user.User user,
                            Group group,
                            Role role)
                     throws Exception
Check if the user belonging to the input group has got the input role.

Parameters:
user - the user.
group - the group wich the user belongs to.
role - the role that the user should have.
Returns:
true if the user has got the input role, false otherwise.
Throws:
Exception - if the query fails.

getUserGroups

public ArrayList getUserGroups(com.pow2.user.User user)
                        throws Exception
Get all the groups for the user.

Parameters:
user - Description of the Parameter
Returns:
an ArrayList of group objects.
Throws:
Exception - if the query fails.

getUserRoles

public ArrayList getUserRoles(com.pow2.user.User user)
                       throws Exception
Get all the roles for the user.

Parameters:
user - Description of the Parameter
Returns:
an ArrayList of role objects.
Throws:
Exception - if the query fails.

getUserRoles

public ArrayList getUserRoles(com.pow2.user.User user,
                              Group group)
                       throws Exception
Get all the roles for the user belonging to the input group.

Parameters:
user - the user.
group - the group wich the user belongs to.
Returns:
an ArrayList of role objects.
Throws:
Exception - if the query fails.

getRolePermissions

public ArrayList getRolePermissions(Role role)
                             throws Exception
Get all the permissions for the input role.

Parameters:
role - Description of the Parameter
Returns:
an ArrayList of role objects.
Throws:
Exception - if the query fails.

hasUserPermission

public boolean hasUserPermission(com.pow2.user.User user,
                                 Permission permission)
                          throws Exception
Check if the user has got the input permission.

Parameters:
user - the user.
permission - Description of the Parameter
Returns:
true if the user has got the input permission, false otherwise.
Throws:
Exception - if the query fails.

hasUserPermission

public boolean hasUserPermission(com.pow2.user.User user,
                                 Group group,
                                 Permission permission)
                          throws Exception
Check if the user belonging to the input group has got the input permission.

Parameters:
user - the user.
group - the group wich the user belongs to.
permission - Description of the Parameter
Returns:
true if the user has got the input permission, false otherwise.
Throws:
Exception - if the query fails.


Copyright © 2002-2003 Power Of Two S.R.L. All Rights Reserved.