org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.utils
Class PrivilegesUtil

java.lang.Object
  extended by org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.utils.PrivilegesUtil

public class PrivilegesUtil
extends java.lang.Object

Privilege related utilities

Author:
Idull

Constructor Summary
PrivilegesUtil()
           
 
Method Summary
static java.util.List getAuthorizationIdentifiers(SQLObject obj)
          Returns all the authorization identifiers
static java.util.List getBelongedGroups(User user, java.util.List authids)
           
static void getBelongedGroups(User user, java.util.List authids, java.util.List belongedGroups)
           
static java.lang.String getDisplayString(java.util.List authids, AuthorizationIdentifier authid, SQLObject sqlObj, java.lang.String action, Privilege p)
          Get the display string for the given privilege
static Privilege[] getInheritedGroupPrivilege(java.util.List authids, User user, SQLObject obj, java.lang.String action)
           
static Privilege[] getInheritedPrivilege(java.util.List authids, AuthorizationIdentifier authid, SQLObject sqlObj, java.lang.String action)
           
static java.lang.String getInheritedPrivilegeDspString(Privilege[] ps)
          Calculates the display string for inherited privileges
static AuthorizationIdentifier getOriginalAuthid(AuthorizationIdentifier authid, java.util.List authids)
          Get the original authorization id from the cloned authorization id
static Privilege getPrivilege(AuthorizationIdentifier authid, SQLObject obj, java.lang.String action)
          Returns the privilege of the given SQL object owned by the given authid with action specified
static IPrivilegeState getPrivilegeState(java.util.List authids, AuthorizationIdentifier authid, SQLObject sqlObj, java.lang.String action)
           
static Privilege[] getReceivedRolePrivilege(AuthorizationIdentifier user, SQLObject obj, java.lang.String action)
           
static java.util.List getReceivedSQLObjectPrivileges(AuthorizationIdentifier authid, SQLObject obj)
          Returns all privileges of the given SQL object owned by the given authid
static Privilege[] getUserInheritedPrivilege(java.util.List authids, User user, SQLObject obj, java.lang.String action)
          Returns the inherited privilege, if no privilege inherited, return null
static boolean hasInheritedPrivilege(java.util.List authids, AuthorizationIdentifier authid, SQLObject sqlObj, java.lang.String action)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrivilegesUtil

public PrivilegesUtil()
Method Detail

getAuthorizationIdentifiers

public static java.util.List getAuthorizationIdentifiers(SQLObject obj)
Returns all the authorization identifiers

Parameters:
authid -
obj - used to locate the catalog or database
Returns:

getReceivedSQLObjectPrivileges

public static java.util.List getReceivedSQLObjectPrivileges(AuthorizationIdentifier authid,
                                                            SQLObject obj)
Returns all privileges of the given SQL object owned by the given authid

Parameters:
authid -
obj -
Returns:

getPrivilege

public static Privilege getPrivilege(AuthorizationIdentifier authid,
                                     SQLObject obj,
                                     java.lang.String action)
Returns the privilege of the given SQL object owned by the given authid with action specified

Parameters:
authid -
obj -
action -
Returns:
a Privilege instance if the user/group/role has, otherwise return null

getBelongedGroups

public static java.util.List getBelongedGroups(User user,
                                               java.util.List authids)

getBelongedGroups

public static void getBelongedGroups(User user,
                                     java.util.List authids,
                                     java.util.List belongedGroups)

getUserInheritedPrivilege

public static Privilege[] getUserInheritedPrivilege(java.util.List authids,
                                                    User user,
                                                    SQLObject obj,
                                                    java.lang.String action)
Returns the inherited privilege, if no privilege inherited, return null

Parameters:
authids -
user -
obj -
action -
Returns:

getReceivedRolePrivilege

public static Privilege[] getReceivedRolePrivilege(AuthorizationIdentifier user,
                                                   SQLObject obj,
                                                   java.lang.String action)

getInheritedGroupPrivilege

public static Privilege[] getInheritedGroupPrivilege(java.util.List authids,
                                                     User user,
                                                     SQLObject obj,
                                                     java.lang.String action)

hasInheritedPrivilege

public static boolean hasInheritedPrivilege(java.util.List authids,
                                            AuthorizationIdentifier authid,
                                            SQLObject sqlObj,
                                            java.lang.String action)

getInheritedPrivilege

public static Privilege[] getInheritedPrivilege(java.util.List authids,
                                                AuthorizationIdentifier authid,
                                                SQLObject sqlObj,
                                                java.lang.String action)

getPrivilegeState

public static IPrivilegeState getPrivilegeState(java.util.List authids,
                                                AuthorizationIdentifier authid,
                                                SQLObject sqlObj,
                                                java.lang.String action)

getInheritedPrivilegeDspString

public static java.lang.String getInheritedPrivilegeDspString(Privilege[] ps)
Calculates the display string for inherited privileges

Parameters:
ps -
Returns:

getOriginalAuthid

public static AuthorizationIdentifier getOriginalAuthid(AuthorizationIdentifier authid,
                                                        java.util.List authids)
Get the original authorization id from the cloned authorization id

Parameters:
authid - cloned authorization id
authids - original authorization id list
Returns:

getDisplayString

public static java.lang.String getDisplayString(java.util.List authids,
                                                AuthorizationIdentifier authid,
                                                SQLObject sqlObj,
                                                java.lang.String action,
                                                Privilege p)
Get the display string for the given privilege