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.

If you are implementing your own attribute def adapter, you should probably extend BaseAccessAdapter
Version:
$Id: AttributeDefAdapter.java,v 1.1 2009-09-21 06:14:26 mchyzer Exp $
  • 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

      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 groups
      privInSet - 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 attrDefs
      hqlTables - is the select and part part (hql prefix)
      hqlWhereClause - is there where clause part of the query
      hqlQuery -
      attrDefColumn - is the name of the attrDef column to join to
      privInSet - 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

      void revokeAllPrivilegesForSubject(GrouperSession grouperSession, Subject subject)
      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 groups
      hql - is the select and part part (hql prefix)
      hqlQuery -
      attributeDefColumn - is the name of the attributeDef column to join to
      privilege - 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 session
      attributeDef - to search on
      privileges - if blank, get all
      membershipType - if immediate, effective, or blank for all
      queryPaging - if a certain page should be returned based on subject
      additionalMembers - 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 groups
      hql - is the select and part part (hql prefix)
      hqlQuery -
      attributeDefColumn - is the name of the attributeDef column to join to
      privilege - 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