org.enhydra.shark.api.internal.usergroup
Interface UserGroupManager


public interface UserGroupManager

UserGroupManager handles users and groups and their relations in Shark.

Author:
Sasa Bojanic, Vladimir Puskas, Tanja Jovanovic

Method Summary
 void configure(CallbackUtilities cus)
          Method configure is called at Shark start up, to configure implementation of UserGroupManager.
 boolean doesGroupBelongToGroup(WMSessionHandle shandle, java.lang.String groupName, java.lang.String subgroupName)
          Returns true if group subgroupName is subgroup of group groupName.
 boolean doesGroupExist(WMSessionHandle shandle, java.lang.String groupName)
          Returns true if user group with given name exists.
 boolean doesUserBelongToGroup(WMSessionHandle shandle, java.lang.String groupName, java.lang.String username)
          Returns true if the given user belongs to the given group.
 boolean doesUserExist(WMSessionHandle shandle, java.lang.String username)
          Returns true if user with given username exists.
 java.lang.String[] getAllGroupnames(WMSessionHandle shandle)
          Returns Ids of all user groups.
 java.lang.String[] getAllGroupnamesForUser(WMSessionHandle shandle, java.lang.String userName)
          Returns Ids of all groups for the given user.
 java.lang.String[] getAllImmediateSubgroupsForGroup(WMSessionHandle shandle, java.lang.String groupName)
          Returns all groups that are immediate children of the given group (which are on the first level bellow the level of the given group).
 java.lang.String[] getAllImmediateUsersForGroup(WMSessionHandle shandle, java.lang.String groupName)
          Returns all users that are immediate children of the given group.
 java.lang.String[] getAllSubgroupsForGroups(WMSessionHandle shandle, java.lang.String[] groupNames)
          Returns all groups that belong to the given groups.
 java.lang.String[] getAllUsers(WMSessionHandle shandle)
          Returns Ids of all users.
 java.lang.String[] getAllUsersForGroups(WMSessionHandle shandle, java.lang.String[] groupNames)
          Returns all users that belong to the given groups.
 java.lang.String getGroupDescription(WMSessionHandle shandle, java.lang.String groupName)
          Returns a group description.
 java.lang.String[] getGroups(WMSessionHandle sessionHandle, java.lang.String expression)
          Return all groups that match the specified expression evaluation.
 java.lang.String[] getObjects(WMSessionHandle sessionHandle, java.lang.String expression)
          Return the list of objects that match specified expression evaluation.
 java.lang.String getUserEMailAddress(WMSessionHandle shandle, java.lang.String username)
          Returns string representing email address for the user with the given username.
 java.lang.String getUserFirstName(WMSessionHandle shandle, java.lang.String username)
          Returns string representing user's first name.
 java.lang.String getUserLastName(WMSessionHandle shandle, java.lang.String username)
          Returns string representing user's last name.
 java.lang.String getUserPassword(WMSessionHandle shandle, java.lang.String username)
          Returns string representing the password for the shark user with the given username.
 java.lang.String getUserRealName(WMSessionHandle shandle, java.lang.String username)
          Returns string representing the real name for the shark user with the given username (first and last name).
 boolean validateUser(java.lang.String username, java.lang.String pwd)
          Validates user.
 

Method Detail

configure

public void configure(CallbackUtilities cus)
               throws java.lang.Exception
Method configure is called at Shark start up, to configure implementation of UserGroupManager.

Parameters:
cus - an instance of CallbackUtilities used to get properties for configuring userg roup manager in Shark.
Throws:
java.lang.Exception - Thrown if configuring doesn't succeed.

getAllGroupnames

public java.lang.String[] getAllGroupnames(WMSessionHandle shandle)
                                    throws java.lang.Exception
Returns Ids of all user groups.

Returns:
List of user group Ids.
Throws:
java.lang.Exception - If something unexpected happens.

getAllGroupnamesForUser

public java.lang.String[] getAllGroupnamesForUser(WMSessionHandle shandle,
                                                  java.lang.String userName)
                                           throws java.lang.Exception
Returns Ids of all groups for the given user.

Parameters:
userName - name of the given user.
Returns:
List of all group ids for the given user.
Throws:
java.lang.Exception - If something unexpected happens.

getAllUsers

public java.lang.String[] getAllUsers(WMSessionHandle shandle)
                               throws java.lang.Exception
Returns Ids of all users.

Returns:
List of user Ids.
Throws:
java.lang.Exception - If something unexpected happens.

getAllUsersForGroups

public java.lang.String[] getAllUsersForGroups(WMSessionHandle shandle,
                                               java.lang.String[] groupNames)
                                        throws java.lang.Exception
Returns all users that belong to the given groups.

Parameters:
groupNames - names of the given groups.
Returns:
List of all users that belong to given groups.
Throws:
java.lang.Exception - If something unexpected happens.

getAllImmediateUsersForGroup

public java.lang.String[] getAllImmediateUsersForGroup(WMSessionHandle shandle,
                                                       java.lang.String groupName)
                                                throws java.lang.Exception
Returns all users that are immediate children of the given group.

Parameters:
groupName - name of the given group.
Returns:
List of all immediate (direct) users that belong to the given group.
Throws:
java.lang.Exception - If something unexpected happens.

getAllSubgroupsForGroups

public java.lang.String[] getAllSubgroupsForGroups(WMSessionHandle shandle,
                                                   java.lang.String[] groupNames)
                                            throws java.lang.Exception
Returns all groups that belong to the given groups.

Parameters:
groupNames - names of the given groups.
Returns:
List of all groups that belong to the given groups.
Throws:
java.lang.Exception - If something unexpected happens.

getAllImmediateSubgroupsForGroup

public java.lang.String[] getAllImmediateSubgroupsForGroup(WMSessionHandle shandle,
                                                           java.lang.String groupName)
                                                    throws java.lang.Exception
Returns all groups that are immediate children of the given group (which are on the first level bellow the level of the given group).

Parameters:
groupName - name of the given group.
Returns:
List of all groups that are immediate children of the given group.
Throws:
java.lang.Exception - If something unexpected happens.

doesGroupExist

public boolean doesGroupExist(WMSessionHandle shandle,
                              java.lang.String groupName)
                       throws java.lang.Exception
Returns true if user group with given name exists.

Parameters:
groupName - name of the given group.
Returns:
true if user group exists, otherwise false.
Throws:
java.lang.Exception - If something unexpected happens.

doesGroupBelongToGroup

public boolean doesGroupBelongToGroup(WMSessionHandle shandle,
                                      java.lang.String groupName,
                                      java.lang.String subgroupName)
                               throws java.lang.Exception
Returns true if group subgroupName is subgroup of group groupName.

Parameters:
groupName - name of the given group.
subgroupName - name of the given subgroup.
Returns:
true if group subgroupName is subgroup of group groupName, otherwise false.
Throws:
java.lang.Exception - If something unexpected happens.

getGroupDescription

public java.lang.String getGroupDescription(WMSessionHandle shandle,
                                            java.lang.String groupName)
                                     throws java.lang.Exception
Returns a group description.

Parameters:
groupName - name of the given group.
Returns:
Group description.
Throws:
java.lang.Exception - If something unexpected happens.

doesUserBelongToGroup

public boolean doesUserBelongToGroup(WMSessionHandle shandle,
                                     java.lang.String groupName,
                                     java.lang.String username)
                              throws java.lang.Exception
Returns true if the given user belongs to the given group.

Parameters:
groupName - name of the given group.
username - username used to uniquely identify shark user.
Returns:
true if the given user belongs to the given group, otherwise false.
Throws:
java.lang.Exception - If something unexpected happens.

doesUserExist

public boolean doesUserExist(WMSessionHandle shandle,
                             java.lang.String username)
                      throws java.lang.Exception
Returns true if user with given username exists.

Parameters:
username - username of the shark user.
Returns:
true if the user with the given username exists, otherwise false.
Throws:
java.lang.Exception - If something unexpected happens.

getUserPassword

public java.lang.String getUserPassword(WMSessionHandle shandle,
                                        java.lang.String username)
                                 throws java.lang.Exception
Returns string representing the password for the shark user with the given username.

Parameters:
username - username of the shark user.
Returns:
password of the shark user.
Throws:
java.lang.Exception - If something unexpected happens.

getUserRealName

public java.lang.String getUserRealName(WMSessionHandle shandle,
                                        java.lang.String username)
                                 throws java.lang.Exception
Returns string representing the real name for the shark user with the given username (first and last name).

Parameters:
username - username of the shark user.
Returns:
Real name of the shark user.
Throws:
java.lang.Exception - If something unexpected happens.

getUserFirstName

public java.lang.String getUserFirstName(WMSessionHandle shandle,
                                         java.lang.String username)
                                  throws java.lang.Exception
Returns string representing user's first name.

Parameters:
username - username of the shark user.
Returns:
First name of the shark user.
Throws:
java.lang.Exception - If something unexpected happens.

getUserLastName

public java.lang.String getUserLastName(WMSessionHandle shandle,
                                        java.lang.String username)
                                 throws java.lang.Exception
Returns string representing user's last name.

Parameters:
username - username of the shark user.
Returns:
Last name of the shark user.
Throws:
java.lang.Exception - If something unexpected happens.

getUserEMailAddress

public java.lang.String getUserEMailAddress(WMSessionHandle shandle,
                                            java.lang.String username)
                                     throws java.lang.Exception
Returns string representing email address for the user with the given username.

Parameters:
username - username of the shark user.
Returns:
Email of the shark user.
Throws:
java.lang.Exception - If something unexpected happens.

getObjects

public java.lang.String[] getObjects(WMSessionHandle sessionHandle,
                                     java.lang.String expression)
                              throws java.lang.Exception
Return the list of objects that match specified expression evaluation.
TODO determine the exact format of the expression parameter so that Shark knows how to create it and the client knows how to process it

Throws:
java.lang.Exception

getGroups

public java.lang.String[] getGroups(WMSessionHandle sessionHandle,
                                    java.lang.String expression)
                             throws java.lang.Exception
Return all groups that match the specified expression evaluation.
TODO determine the exact format of the expression parameter so that Shark knows how to create it and the client knows how to process it

Throws:
java.lang.Exception

validateUser

public boolean validateUser(java.lang.String username,
                            java.lang.String pwd)
                     throws java.lang.Exception
Validates user.

Parameters:
username - user name.
pwd - user password.
Returns:
true if user is validated, otherwise false.
Throws:
java.lang.Exception - If something unexpected happens.