Interface Directories

All Superinterfaces:
Serializable
All Known Subinterfaces:
AdminGroups

public interface Directories extends Serializable
An interface to handle directory information and groups.

Groups may be stored in a site specific manner so the actual implementation used is a build-time configuration option. They may be ldap directory based or implemented by storing in the calendar database.

Methods may throw an unimplemented exception if functions are not available.

Version:
3.3.2
Author:
Mike Douglass douglm rpi.edu
  • Method Details

    • init

      void init(Directories.CallBack cb, Configurations configs)
      Provide the callback object
      Parameters:
      cb - callback
      configs - Configuratiosn object
    • getConfigName

      String getConfigName()
      Return the name of the configuration properties for the module, e.g "module.user-ldap-group" or "module.dir-config"
      Returns:
      String
    • getDirectoryInfo

      DirectoryInfo getDirectoryInfo()
      Get application visible directory information.
      Returns:
      DirectoryInfo
    • validPrincipal

      boolean validPrincipal(String href)
      Test for a valid principal in the directory. This may have a number of uses. For example, when organizing meetings we may want to send an invitation to a user who has not yet logged on. This allows us to distinguish between a bad account (spam maybe?) and a real account.

      Sites may wish to override this method to check their directory to see if the principal exists.

      Parameters:
      href - of principal
      Returns:
      true if it's a valid principal
    • isPrincipal

      boolean isPrincipal(String val)
      Does the value appear to represent a valid principal?
      Parameters:
      val - href of principal
      Returns:
      true if it's a (possible) principal
    • accountFromPrincipal

      String accountFromPrincipal(String val)
      If this is a valid user principal return the account.
      Parameters:
      val - href of principal
      Returns:
      account or null if not valid user principal
    • getPrincipal

      BwPrincipal<?> getPrincipal(String href) throws CalFacadeException
      Return principal for the given href.
      Parameters:
      href - ofprincipal
      Returns:
      Principal
      Throws:
      CalFacadeException
    • getDefaultDomain

      String getDefaultDomain()
      Needed for the ischedule service
      Returns:
      the default domain for the service.
    • getGroups

      Collection<String> getGroups(String rootUrl, String principalUrl) throws CalFacadeException
      The urls should be principal urls. principalUrl can null for the current user. The result is a collection of principal urls of which the given url is a member, based upon rootUrl. For example, if rootUrl points to the base of the user principal hierarchy, then the rsult should be at least the current user's principal url, remembering that user principals are themselves groups and the user is considered a member of their own group.
      Parameters:
      rootUrl - - url to base search on.
      principalUrl - - url of principal or null for current user
      Returns:
      Collection of urls - always non-null
      Throws:
      CalFacadeException
    • makePrincipalUri

      String makePrincipalUri(String id, int whoType)
      Parameters:
      id - account
      whoType - - from WhoDefs
      Returns:
      String principal uri
    • uriToCaladdr

      String uriToCaladdr(String val)
      Given a uri return a calendar address. This should handle actions such as turning
      auser
      into the associated calendar address of
      mailto:auser@ahost.org

      It should also deal with user@somewhere.org to mailto:user@somewhere.org

      Note: this method and userToCalAddr should be doing lookups of the enterprise directory (or carddav) to determine the calendar user address. For the moment we do a transform of the account to get a mailto.

      Parameters:
      val - uri
      Returns:
      caladdr for this system or null for an invalid uri
    • principalToCaladdr

      String principalToCaladdr(BwPrincipal<?> val)
      Given a user principal return a calendar address.
      Parameters:
      val - principal
      Returns:
      caladdr
    • userToCaladdr

      String userToCaladdr(String val)
      Given a user account return a calendar address. For example, we might have an account
      auser
      with the associated calendar address of
      mailto:auser@ahost.org

      Note: this method and uriToCalAddr should be doing lookups of the enterprise directory (or carddav) to determine the calendar user address. For the moment we do a transform of the account to get a mailto.

      Parameters:
      val - account
      Returns:
      caladdr for this system
      Throws:
      RuntimeException - for errors
    • caladdrToPrincipal

      BwPrincipal<?> caladdrToPrincipal(String caladdr)
      Given a calendar address return the associated calendar account. For example, we might have a calendar address
      mailto:auser@ahost.org
      with the associated account of
      auser

      We also allow user principals

      Wherever we need a user account use the converted value. Call userToCaladdr for the inverse.

      Parameters:
      caladdr - calendar address
      Returns:
      account or null if not caladdr for this system
    • normalizeCua

      String normalizeCua(String val) throws CalFacadeException
      Ensure we have something that looks like a valid calendar user address. Could be a mailto: or a principal
      Parameters:
      val - String potential calendar user address
      Returns:
      String valid or null invalid.
      Throws:
      CalFacadeException
    • getDirInfo

      Return some sort of directory information for the given principal.
      Parameters:
      p - principal for which we want info
      Returns:
      BwPrincipalInfo directory information.
      Throws:
      CalFacadeException
    • find

      List<BwPrincipalInfo> find(List<org.bedework.webdav.servlet.shared.WebdavProperty> props, List<org.bedework.webdav.servlet.shared.WebdavProperty> returnProps, String cutype, javax.xml.ws.Holder<Boolean> truncated)
      Return matching principals.
      Parameters:
      props - to match
      returnProps - used to configure returned data
      cutype - null - or type
      truncated - value is true if result is incomplete
      Returns:
      BwPrincipalInfo objects that match.
    • find

      List<BwPrincipalInfo> find(String cua, String cutype, boolean expand, javax.xml.ws.Holder<Boolean> truncated)
      Return principals tha match the CUA.
      Parameters:
      cua - a calendar user address
      cutype - individual, group etc (null for individual)
      expand - if true expand any groups so that the info contains group member info.
      Returns:
      BwPrincipalInfo objects that match.
    • mergePreferences

      boolean mergePreferences(BwPreferences prefs, BwPrincipalInfo pinfo) throws CalFacadeException
      Uses the values in pinfo to update the supplied preferences. This may be a site specific operation. It allows bedework to use directory information to alter the behavior of principals. For example, we can define resources in a directory and the auto-respond behavior will be turned on in bedework scheduling.
      Parameters:
      prefs -
      pinfo -
      Returns:
      boolean true if preferences updated
      Throws:
      CalFacadeException
    • getGroups

      Collection<BwGroup<?>> getGroups(BwPrincipal<?> val) throws CalFacadeException
      Return all groups of which the given principal is a member. Never returns null.

      Does not check the returned groups for membership of other groups.

      Parameters:
      val - a principal
      Returns:
      Collection of BwGroup
      Throws:
      CalFacadeException
    • getAllGroups

      Collection<BwGroup<?>> getAllGroups(BwPrincipal<?> val) throws CalFacadeException
      Return all groups of which the given principal is a member. Never returns null.

      This does check the groups for membership of other groups so the returned collection gives the groups of which the principal is directly or indirectly a member.

      Parameters:
      val - a principal
      Returns:
      Collection of BwGroup
      Throws:
      CalFacadeException
    • getGroupMaintOK

      boolean getGroupMaintOK()
      Show whether entries can be modified with this class. Some sites may use other mechanisms.
      Returns:
      boolean true if group maintenance is implemented.
    • getAll

      Collection<BwGroup<?>> getAll(boolean populate) throws CalFacadeException
      Return all groups to which this user has some access. Never returns null.
      Parameters:
      populate - boolean populate with members
      Returns:
      Collection of BwGroup
      Throws:
      CalFacadeException
    • getMembers

      void getMembers(BwGroup<?> group) throws CalFacadeException
      Populate the group with a (possibly empty) Collection of members. Does not populate groups which are members.
      Parameters:
      group - BwGroup group object to add
      Throws:
      CalFacadeException
    • addGroup

      void addGroup(BwGroup<?> group) throws CalFacadeException
      Add a group
      Parameters:
      group - BwGroup group object to add
      Throws:
      CalFacadeException - If there's a problem
    • findGroup

      BwGroup<?> findGroup(String name)
      Find a group given its name
      Parameters:
      name - String group name
      Returns:
      BwGroup group object
      Throws:
      RuntimeException - If there's a problem
    • addMember

      void addMember(BwGroup<?> group, BwPrincipal<?> val) throws CalFacadeException
      Add a principal to a group
      Parameters:
      group - a group principal
      val - BwPrincipal new member
      Throws:
      CalFacadeException - For invalid usertype values.
    • removeMember

      void removeMember(BwGroup<?> group, BwPrincipal<?> val) throws CalFacadeException
      Remove a member from a group
      Parameters:
      group - a group principal
      val - BwPrincipal new member
      Throws:
      CalFacadeException - For invalid usertype values.
    • removeGroup

      void removeGroup(BwGroup<?> group) throws CalFacadeException
      Delete a group
      Parameters:
      group - BwGroup group object to delete
      Throws:
      CalFacadeException - If there's a problem
    • updateGroup

      void updateGroup(BwGroup<?> group) throws CalFacadeException
      update a group. This may have no meaning in some directories.
      Parameters:
      group - BwGroup group object to update
      Throws:
      CalFacadeException - If there's a problem
    • findGroupParents

      Collection<BwGroup<?>> findGroupParents(BwGroup<?> group) throws CalFacadeException
      Parameters:
      group -
      Returns:
      Collection
      Throws:
      CalFacadeException
    • getAdminGroupsIdPrefix

      String getAdminGroupsIdPrefix()
      Returns:
      String used to prefix administrative group names to distinguish them from user group names.