Interface AttributeDefAdapter
- All Known Implementing Classes:
BaseAttrDefAdapter
,GrouperAttributeDefAdapter
,GrouperNonDbAttrDefAdapter
public interface AttributeDefAdapter
Grouper AttributeDef Privilege interface.
Unless you are implementing a new implementation of this interface,
you should not need to directly use these methods as they are all
wrapped by methods in the AttributeDef
class.
- Version:
- $Id: AttributeDefAdapter.java,v 1.1 2009-09-21 06:14:26 mchyzer Exp $
-
Method Summary
Modifier and TypeMethodDescriptiongetAttributeDefsWhereSubjectDoesHavePrivilege
(GrouperSession grouperSession, String stemId, Stem.Scope scope, Subject subject, Privilege privilege, boolean considerAllSubject, String sqlLikeString) find the attributeDefs which do have a certain privilegegetAttributeDefsWhereSubjectDoesntHavePrivilege
(GrouperSession grouperSession, String stemId, Stem.Scope scope, Subject subject, Privilege privilege, boolean considerAllSubject, String sqlLikeString) find the attributeDefs which do not have a certain privilegegetAttributeDefsWhereSubjectHasPriv
(GrouperSession grouperSession, Subject subj, Privilege priv) Get all attribute defs where this subject has this privilege.getPrivs
(GrouperSession grouperSession, AttributeDef attributeDef, Subject subj) Get all privileges held by this subject on this attribute definition.getSubjectsWithPriv
(GrouperSession s, AttributeDef attributeDef, Privilege priv) Get all subjects with this privilege on this attribute definition.void
grantPriv
(GrouperSession grouperSession, AttributeDef attributeDef, Subject subj, Privilege priv, String uuid) Grant the privilege to the subject on this attrDef.boolean
hasPriv
(GrouperSession grouperSession, AttributeDef attributeDef, Subject subj, Privilege priv) Check whether the subject has this privilege on this attrDef.boolean
hqlFilterAttrDefsWhereClause
(GrouperSession grouperSession, Subject subject, HqlQuery hqlQuery, StringBuilder hqlTables, StringBuilder hqlWhereClause, String attrDefColumn, Set<Privilege> privInSet) for an attrDef query, check to make sure the subject can see the records (if filtering HQL, you can do the postHqlFilterAttrDefs instead if you like).boolean
hqlFilterAttributeDefsNotWithPrivWhereClause
(GrouperSession grouperSession, Subject subject, HqlQuery hqlQuery, StringBuilder hql, String attributeDefColumn, Privilege privilege, boolean considerAllSubject) for an attributeDef query, check to make sure the subject cant see the records (if filtering HQL, you can do the postHqlFilterAttributeDefs instead if you like).boolean
hqlFilterAttributeDefsWithPrivWhereClause
(GrouperSession grouperSession, Subject subject, HqlQuery hqlQuery, StringBuilder hql, String attributeDefColumn, Privilege privilege, boolean considerAllSubject) for an attributeDef query, check to make sure the subject has priv (if filtering HQL, you can do the postHqlFilterAttributeDefs instead if you like).postHqlFilterAttributeAssigns
(GrouperSession grouperSession, Subject subject, Set<AttributeAssign> attributeAssigns) filter attribute assignments for things the subject can see, assume underlying assignments are ok to viewpostHqlFilterAttributeDefs
(GrouperSession grouperSession, Set<AttributeDef> attributeDefs, Subject subject, Set<Privilege> privInSet) after HQL is run, filter attributeDefs.postHqlFilterPermissions
(GrouperSession grouperSession, Subject subject, Set<PermissionEntry> permissionEntries) filter permissionEntries for things the subject can see, assume underlying assignments are ok to viewpostHqlFilterPITAttributeAssigns
(GrouperSession grouperSession, Subject subject, Set<PITAttributeAssign> pitAttributeAssigns) filter pit attribute assignments for things the subject can see, assume underlying assignments are ok to viewvoid
privilegeCopy
(GrouperSession grouperSession, AttributeDef attributeDef1, AttributeDef attributeDef2, 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, AttributeDef attributeDef, 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 grouperSession, AttributeDef attributeDef, Privilege priv) Revoke this privilege from everyone on this attrDef.void
revokePriv
(GrouperSession grouperSession, AttributeDef attributeDef, Subject subj, Privilege priv) Revoke the privilege from the subject on this attrDef.
-
Method Details
-
getSubjectsWithPriv
Set<Subject> getSubjectsWithPriv(GrouperSession s, AttributeDef attributeDef, Privilege priv) throws SchemaException Get all subjects with this privilege on this attribute definition.Set admins = ap.getSubjectsWithPriv(s, attrDef, AccessPrivilege.ADMIN);
- Parameters:
s
- Get privileges within this session context.attributeDef
- Get privileges on this attribute definition.priv
- Get this privilege.- Returns:
- Set of
Subject
objects. - Throws:
SchemaException
-
getAttributeDefsWhereSubjectHasPriv
Set<AttributeDef> getAttributeDefsWhereSubjectHasPriv(GrouperSession grouperSession, Subject subj, Privilege priv) throws SchemaException Get all attribute defs where this subject has this privilege.try { Set isAdmin = ap.getAttributeDefsWhereSubjectHasPriv( s, subj, AccessPrivilege.ADMIN ); } catch (SchemaException eS) { // Invalid priv }
- Parameters:
grouperSession
- Get privileges within this session context.subj
- Get privileges for this subject.priv
- Get this privilege.- Returns:
- Set of
AttributeDef
objects. - Throws:
SchemaException
-
getPrivs
Set<AttributeDefPrivilege> getPrivs(GrouperSession grouperSession, AttributeDef attributeDef, Subject subj) Get all privileges held by this subject on this attribute definition.Set privs = ap.getPrivs(s, g, subj);
- Parameters:
grouperSession
- Get privileges within this session context.attributeDef
- Get privileges on this attrDef.subj
- Get privileges for this member.- Returns:
- Set of privileges.
-
grantPriv
void grantPriv(GrouperSession grouperSession, AttributeDef attributeDef, Subject subj, Privilege priv, String uuid) throws GrantPrivilegeException, InsufficientPrivilegeException, SchemaException Grant the privilege to the subject on this attrDef.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 } catch (SchemaException e2) { // Invalid privilege }
- Parameters:
grouperSession
- Grant privilege in this session context.attributeDef
- Grant privilege on this attrDef.subj
- Grant privilege to this subject.priv
- Grant this privilege.uuid
- is uuid or null if assign one- Throws:
GrantPrivilegeException
InsufficientPrivilegeException
SchemaException
-
hasPriv
boolean hasPriv(GrouperSession grouperSession, AttributeDef attributeDef, Subject subj, Privilege priv) throws SchemaException Check whether the subject has this privilege on this attrDef.try { ap.hasPriv(s, g, subject, AccessPrivilege.ADMIN); } catch (SchemaException e) { // Invalid privilege }
- Parameters:
grouperSession
- Check privilege in this session context.attributeDef
- Check privilege on this attrDef.subj
- Check privilege for this subject.priv
- Check this privilege.- Returns:
- if has priv
- Throws:
SchemaException
-
revokePriv
void revokePriv(GrouperSession grouperSession, AttributeDef attributeDef, Privilege priv) throws InsufficientPrivilegeException, RevokePrivilegeException, SchemaException Revoke this privilege from everyone on this attrDef.try { ap.revokePriv(s, g, AccessPrivilege.ADMIN); } catch (InsufficientPrivilegeException eIP) { // Not privileged to revoke the privilege } catch (RevokePrivilegeException eRP) { // Unable to revoke the privilege }
- Parameters:
grouperSession
- Revoke privilege in this session context.attributeDef
- Revoke privilege on this group.priv
- Revoke this privilege.- Throws:
InsufficientPrivilegeException
RevokePrivilegeException
SchemaException
-
revokePriv
void revokePriv(GrouperSession grouperSession, AttributeDef attributeDef, Subject subj, Privilege priv) throws InsufficientPrivilegeException, RevokePrivilegeException, SchemaException Revoke the privilege from the subject on this attrDef.try { ap.revokePriv(s, g, subj, AccessPrivilege.ADMIN); } catch (InsufficientPrivilegeException eIP) { // Not privileged to revoke the privilege } catch (RevokePrivilegeException eRP) { // Unable to revoke the privilege }
- Parameters:
grouperSession
- Revoke privilege in this session context.attributeDef
- Revoke privilege on this attrDef.subj
- Revoke privilege from this subject.priv
- Revoke this privilege.- Throws:
InsufficientPrivilegeException
RevokePrivilegeException
SchemaException
-
privilegeCopy
void privilegeCopy(GrouperSession grouperSession, AttributeDef attributeDef1, AttributeDef attributeDef2, Privilege priv) throws InsufficientPrivilegeException, GrantPrivilegeException, SchemaException Copies privileges for subjects that have the specified privilege on g1 to g2.- Parameters:
grouperSession
-attributeDef1
-attributeDef2
-priv
-- Throws:
InsufficientPrivilegeException
GrantPrivilegeException
SchemaException
-
privilegeCopy
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 AttributeDef x, this method will result with subj2 having ADMIN privilege to AttributeDef x.- Parameters:
s
-subj1
-subj2
-priv
-- Throws:
InsufficientPrivilegeException
GrantPrivilegeException
SchemaException
-
postHqlFilterAttributeDefs
Set<AttributeDef> postHqlFilterAttributeDefs(GrouperSession grouperSession, Set<AttributeDef> attributeDefs, Subject subject, Set<Privilege> privInSet) after HQL is run, filter attributeDefs. If you are filtering in HQL, then dont filter here- Parameters:
grouperSession
-attributeDefs
-subject
- which needs view access to the groupsprivInSet
- find a privilege which is in this set (e.g. for view, send all access privs). There are pre-canned sets in AccessAdapter- Returns:
- the set of filtered groups
-
hqlFilterAttrDefsWhereClause
boolean hqlFilterAttrDefsWhereClause(GrouperSession grouperSession, Subject subject, HqlQuery hqlQuery, StringBuilder hqlTables, StringBuilder hqlWhereClause, String attrDefColumn, Set<Privilege> privInSet) for an attrDef query, check to make sure the subject can see the records (if filtering HQL, you can do the postHqlFilterAttrDefs instead if you like). Note, this joins to tables, so the queries should probably be "distinct"- Parameters:
grouperSession
-subject
- which needs view access to the attrDefshqlTables
- is the select and part part (hql prefix)hqlWhereClause
- is there where clause part of the queryhqlQuery
-attrDefColumn
- is the name of the attrDef column to join toprivInSet
- find a privilege which is in this set (e.g. for view, send all access privs). There are pre-canned sets in AccessPrivilege- Returns:
- if the query was changed
-
postHqlFilterAttributeAssigns
Set<AttributeAssign> postHqlFilterAttributeAssigns(GrouperSession grouperSession, Subject subject, Set<AttributeAssign> attributeAssigns) filter attribute assignments for things the subject can see, assume underlying assignments are ok to view- Parameters:
grouperSession
-attributeAssigns
-subject
-- Returns:
- the memberships
-
postHqlFilterPITAttributeAssigns
Set<PITAttributeAssign> postHqlFilterPITAttributeAssigns(GrouperSession grouperSession, Subject subject, Set<PITAttributeAssign> pitAttributeAssigns) filter pit attribute assignments for things the subject can see, assume underlying assignments are ok to view- Parameters:
grouperSession
-pitAttributeAssigns
-subject
-- Returns:
- the pit attribute assignments
-
revokeAllPrivilegesForSubject
Revoke all access privileges that this subject has.- Parameters:
grouperSession
-subject
-
-
postHqlFilterPermissions
Set<PermissionEntry> postHqlFilterPermissions(GrouperSession grouperSession, Subject subject, Set<PermissionEntry> permissionEntries) filter permissionEntries for things the subject can see, assume underlying assignments are ok to view- Parameters:
grouperSession
-permissionEntries
-subject
-- Returns:
- the memberships
-
getAttributeDefsWhereSubjectDoesntHavePrivilege
Set<AttributeDef> getAttributeDefsWhereSubjectDoesntHavePrivilege(GrouperSession grouperSession, String stemId, Stem.Scope scope, Subject subject, Privilege privilege, boolean considerAllSubject, String sqlLikeString) find the attributeDefs which do not have a certain privilege- Parameters:
grouperSession
-stemId
-scope
-subject
-privilege
-considerAllSubject
-sqlLikeString
-- Returns:
- the attributeDefs
-
hqlFilterAttributeDefsNotWithPrivWhereClause
boolean hqlFilterAttributeDefsNotWithPrivWhereClause(GrouperSession grouperSession, Subject subject, HqlQuery hqlQuery, StringBuilder hql, String attributeDefColumn, Privilege privilege, boolean considerAllSubject) for an attributeDef query, check to make sure the subject cant see the records (if filtering HQL, you can do the postHqlFilterAttributeDefs instead if you like).- Parameters:
grouperSession
-subject
- which needs view access to the groupshql
- is the select and part part (hql prefix)hqlQuery
-attributeDefColumn
- is the name of the attributeDef column to join toprivilege
- find a privilege which is in this set (e.g. attributeDef privs).considerAllSubject
- if true, then consider GrouperAll when seeing if doesnt have privilege, else do consider- Returns:
- if the query was changed
-
retrievePrivileges
Set<PrivilegeSubjectContainer> retrievePrivileges(GrouperSession grouperSession, AttributeDef attributeDef, 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 combination- Parameters:
grouperSession
- grouper sessionattributeDef
- 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
-
hqlFilterAttributeDefsWithPrivWhereClause
boolean hqlFilterAttributeDefsWithPrivWhereClause(GrouperSession grouperSession, Subject subject, HqlQuery hqlQuery, StringBuilder hql, String attributeDefColumn, Privilege privilege, boolean considerAllSubject) for an attributeDef query, check to make sure the subject has priv (if filtering HQL, you can do the postHqlFilterAttributeDefs instead if you like).- Parameters:
grouperSession
-subject
- which needs view access to the groupshql
- is the select and part part (hql prefix)hqlQuery
-attributeDefColumn
- is the name of the attributeDef column to join toprivilege
- find a privilege which is in this set (e.g. attributeDef privs).considerAllSubject
- if true, then consider GrouperAll when seeing if doesnt have privilege, else do consider- Returns:
- if the query was changed
-
getAttributeDefsWhereSubjectDoesHavePrivilege
Set<AttributeDef> getAttributeDefsWhereSubjectDoesHavePrivilege(GrouperSession grouperSession, String stemId, Stem.Scope scope, Subject subject, Privilege privilege, boolean considerAllSubject, String sqlLikeString) find the attributeDefs which do have a certain privilege- Parameters:
grouperSession
-stemId
-scope
-subject
-privilege
-considerAllSubject
-sqlLikeString
-- Returns:
- the attributeDefs
-