Class GrouperNonDbAccessAdapter
java.lang.Object
edu.internet2.middleware.grouper.privs.BaseAccessAdapter
edu.internet2.middleware.grouper.privs.GrouperNonDbAccessAdapter
- All Implemented Interfaces:
AccessAdapter
- Direct Known Subclasses:
GrouperAccessAdapter
This is the base grouper implementation which implements the required
access adapter methods, but not the db specific ones. This should be
slower and more explicit than the GrouperAccessAdapter (subclass)
- Version:
- $Id: GrouperNonDbAccessAdapter.java,v 1.8 2009-12-07 07:31:09 mchyzer Exp $
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetGroupsWhereSubjectDoesHavePrivilege
(GrouperSession grouperSession, String stemId, Stem.Scope scope, Subject subject, Privilege privilege, boolean considerAllSubject, String sqlLikeString) Get all groups where this subject does have this privilege.getGroupsWhereSubjectDoesntHavePrivilege
(GrouperSession grouperSession, String stemId, Stem.Scope scope, Subject subject, Privilege privilege, boolean considerAllSubject, String sqlLikeString) Get all groups where this subject doesnt have this privilege.getGroupsWhereSubjectHasPriv
(GrouperSession s, Subject subj, Privilege priv) Get all groups where this subject has this privilege.getPrivs
(GrouperSession s, Group g, Subject subj) Get all privileges held by this subject on this group.getStemsWhereGroupThatSubjectHasPrivilege
(GrouperSession grouperSession, Subject subject, Privilege privilege) get stems where a group exists where the subject has privilegegetSubjectsWithPriv
(GrouperSession s, Group g, Privilege priv) Get all subjects with this privilege on this group.void
Grant the privilege to the subject on this group.boolean
hasPriv
(GrouperSession s, Group g, Subject subj, Privilege priv) Check whether the subject has this privilege on this group.void
privilegeCopy
(GrouperSession s, Group g1, Group g2, Privilege priv) Copies privileges for subjects that have the specified privilege on g1 to g2.void
privilegeCopy
(GrouperSession s, Subject subj1, Subject subj2, Privilege priv) Copies privileges of type priv on any subject for the given Subject subj1 to the given Subject subj2.retrievePrivileges
(GrouperSession grouperSession, Group group, Set<Privilege> privileges, MembershipType membershipType, QueryPaging queryPaging, Set<Member> additionalMembers) get a list of privilege subjects, there are no results with the same subject/privilege combinationvoid
revokeAllPrivilegesForSubject
(GrouperSession grouperSession, Subject subject) Revoke all access privileges that this subject has.void
revokePriv
(GrouperSession s, Group g, Privilege priv) Revoke this privilege from everyone on this group.void
revokePriv
(GrouperSession s, Group g, Subject subj, Privilege priv) Revoke the privilege from the subject on this group.Methods inherited from class edu.internet2.middleware.grouper.privs.BaseAccessAdapter
hqlFilterGroupsNotWithPrivWhereClause, hqlFilterGroupsWhereClause, hqlFilterGroupsWithPrivWhereClause, postHqlFilterGroups, postHqlFilterMemberships, postHqlFilterStemsWithGroups
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.internet2.middleware.grouper.privs.AccessAdapter
hqlFilterGroupsNotWithPrivWhereClause, hqlFilterGroupsWhereClause, hqlFilterGroupsWithPrivWhereClause, postHqlFilterGroups, postHqlFilterMemberships, postHqlFilterStemsWithGroups
-
Field Details
-
priv2list
-
-
Constructor Details
-
GrouperNonDbAccessAdapter
public GrouperNonDbAccessAdapter()
-
-
Method Details
-
getSubjectsWithPriv
Description copied from interface:AccessAdapter
Get all subjects with this privilege on this group.Set admins = ap.getSubjectsWithPriv(s, g, AccessPrivilege.ADMIN);
- Specified by:
getSubjectsWithPriv
in interfaceAccessAdapter
- Parameters:
s
- Get privileges within this session context.g
- Get privileges on this group.priv
- Get this privilege.- Returns:
- Set of
Subject
objects. - Throws:
SchemaException
- See Also:
-
getGroupsWhereSubjectHasPriv
public Set<Group> getGroupsWhereSubjectHasPriv(GrouperSession s, Subject subj, Privilege priv) throws SchemaException Get all groups where this subject has this privilege.try { Set isAdmin = ap.getGroupsWhereSubjectHasPriv( s, subj, AccessPrivilege.ADMIN ); } catch (SchemaException eS) { // Invalid priv }
- Specified by:
getGroupsWhereSubjectHasPriv
in interfaceAccessAdapter
- Parameters:
s
- Get privileges within this session context.subj
- Get privileges for this subject.priv
- Get this privilege.- Returns:
- Set of
Group
objects. - Throws:
SchemaException
-
getGroupsWhereSubjectDoesntHavePrivilege
public Set<Group> getGroupsWhereSubjectDoesntHavePrivilege(GrouperSession grouperSession, String stemId, Stem.Scope scope, Subject subject, Privilege privilege, boolean considerAllSubject, String sqlLikeString) Get all groups where this subject doesnt have this privilege.- Specified by:
getGroupsWhereSubjectDoesntHavePrivilege
in interfaceAccessAdapter
- Parameters:
grouperSession
-stemId
-scope
-subject
-privilege
-considerAllSubject
-sqlLikeString
-- Returns:
- groups
-
getStemsWhereGroupThatSubjectHasPrivilege
public Set<Stem> getStemsWhereGroupThatSubjectHasPrivilege(GrouperSession grouperSession, Subject subject, Privilege privilege) Description copied from interface:AccessAdapter
get stems where a group exists where the subject has privilege- Specified by:
getStemsWhereGroupThatSubjectHasPrivilege
in interfaceAccessAdapter
- Returns:
- the stems
- See Also:
-
getPrivs
Get all privileges held by this subject on this group.Set privs = ap.getPrivs(s, g, subj);
- Specified by:
getPrivs
in interfaceAccessAdapter
- Parameters:
s
- Get privileges within this session context.g
- Get privileges on this group.subj
- Get privileges for this member.- Returns:
- Set of privileges.
-
grantPriv
public void grantPriv(GrouperSession s, Group g, Subject subj, Privilege priv, String uuid) throws GrantPrivilegeException, InsufficientPrivilegeException, SchemaException Grant the privilege to the subject on this group.try { ap.grantPriv(s, g, subj, AccessPrivilege.ADMIN); } catch (GrantPrivilegeException e0) { // Unable to grant the privilege } catch (InsufficientPrivilegeException e1) { // Not privileged to grant the privilege }
- Specified by:
grantPriv
in interfaceAccessAdapter
- Parameters:
s
- Grant privilege in this session context.g
- Grant privilege on this group.subj
- Grant privilege to this subject.priv
- Grant this privilege.uuid
-- Throws:
GrantPrivilegeException
InsufficientPrivilegeException
SchemaException
-
hasPriv
public boolean hasPriv(GrouperSession s, Group g, Subject subj, Privilege priv) throws SchemaException Description copied from interface:AccessAdapter
Check whether the subject has this privilege on this group.try { ap.hasPriv(s, g, subject, AccessPrivilege.ADMIN); } catch (SchemaException e) { // Invalid privilege }
- Specified by:
hasPriv
in interfaceAccessAdapter
- Parameters:
s
- Check privilege in this session context.g
- Check privilege on this group.subj
- Check privilege for this subject.priv
- Check this privilege.- Returns:
- if has priv
- Throws:
SchemaException
- See Also:
-
privilegeCopy
public void privilegeCopy(GrouperSession s, Group g1, Group g2, Privilege priv) throws InsufficientPrivilegeException, GrantPrivilegeException, SchemaException Copies privileges for subjects that have the specified privilege on g1 to g2.- Specified by:
privilegeCopy
in interfaceAccessAdapter
- Parameters:
s
-g1
-g2
-priv
-- Throws:
InsufficientPrivilegeException
GrantPrivilegeException
SchemaException
-
privilegeCopy
public void privilegeCopy(GrouperSession s, Subject subj1, Subject subj2, Privilege priv) throws InsufficientPrivilegeException, GrantPrivilegeException, SchemaException Copies privileges of type priv on any subject for the given Subject subj1 to the given Subject subj2. For instance, if subj1 has ADMIN privilege to Group x, this method will result with subj2 having ADMIN privilege to Group x.- Specified by:
privilegeCopy
in interfaceAccessAdapter
- Parameters:
s
-subj1
-subj2
-priv
-- Throws:
InsufficientPrivilegeException
GrantPrivilegeException
SchemaException
-
revokePriv
public void revokePriv(GrouperSession s, Group g, Privilege priv) throws InsufficientPrivilegeException, RevokePrivilegeException, SchemaException Revoke this privilege from everyone on this group.try { ap.revokePriv(s, g, AccessPrivilege.ADMIN); } catch (InsufficientPrivilegeException eIP) { // Not privileged to revoke the privilege } catch (RevokePrivilegeException eRP) { // Unable to revoke the privilege }
- Specified by:
revokePriv
in interfaceAccessAdapter
- Parameters:
s
- Revoke privilege in this session context.g
- Revoke privilege on this group.priv
- Revoke this privilege.- Throws:
InsufficientPrivilegeException
RevokePrivilegeException
SchemaException
-
revokePriv
public void revokePriv(GrouperSession s, Group g, Subject subj, Privilege priv) throws InsufficientPrivilegeException, RevokePrivilegeException, SchemaException Revoke the privilege from the subject on this group.try { ap.revokePriv(s, g, subj, AccessPrivilege.ADMIN); } catch (InsufficientPrivilegeException e0) { // Not privileged to grant the privilege } catch (RevokePrivilegeException e2) { // Unable to revoke the privilege }
- Specified by:
revokePriv
in interfaceAccessAdapter
- Parameters:
s
- Revoke privilege in this session context.g
- Revoke privilege on this group.subj
- Revoke privilege from this subject.priv
- Revoke this privilege.- Throws:
InsufficientPrivilegeException
RevokePrivilegeException
SchemaException
-
revokeAllPrivilegesForSubject
Description copied from interface:AccessAdapter
Revoke all access privileges that this subject has. -
retrievePrivileges
public Set<PrivilegeSubjectContainer> retrievePrivileges(GrouperSession grouperSession, Group group, Set<Privilege> privileges, MembershipType membershipType, QueryPaging queryPaging, Set<Member> additionalMembers) Description copied from interface:AccessAdapter
get a list of privilege subjects, there are no results with the same subject/privilege combination- Specified by:
retrievePrivileges
in interfaceAccessAdapter
- Parameters:
grouperSession
- grouper sessiongroup
- to search onprivileges
- if blank, get allmembershipType
- if immediate, effective, or blank for allqueryPaging
- if a certain page should be returned based on subjectadditionalMembers
- additional members to query that the user is finding or adding- Returns:
- the privilege subject combinations
- See Also:
-
edu.internet2.middleware.grouper.privsAccessAdapter#retrievePrivileges(edu.internet2.middleware.grouper.GrouperSession, Group, java.util.Set, edu.internet2.middleware.grouper.membership.MembershipType, edu.internet2.middleware.grouper.internal.dao.QueryPaging, Set)
-
getGroupsWhereSubjectDoesHavePrivilege
public Set<Group> getGroupsWhereSubjectDoesHavePrivilege(GrouperSession grouperSession, String stemId, Stem.Scope scope, Subject subject, Privilege privilege, boolean considerAllSubject, String sqlLikeString) Get all groups where this subject does have this privilege.- Specified by:
getGroupsWhereSubjectDoesHavePrivilege
in interfaceAccessAdapter
- Parameters:
grouperSession
-stemId
-scope
-subject
-privilege
-considerAllSubject
-sqlLikeString
-- Returns:
- groups
-