java.lang.Object
edu.internet2.middleware.grouper.app.dropbox.DropboxUser

public class DropboxUser extends Object
Domain object for a Dropbox Business team member (the "entity").

Maps to the Dropbox Team API member profile as returned by /2/team/members/list_v2 and /2/team/members/get_info_v2. Grouper matches members by external_id (which Grouper sets, e.g. to the pennname) and uses the native team_member_id for group membership operations.

  • Field Details

    • STATUS_ACTIVE

      public static final String STATUS_ACTIVE
      member status: active member of the team
      See Also:
    • STATUS_INVITED

      public static final String STATUS_INVITED
      member status: invited but not yet joined
      See Also:
    • STATUS_SUSPENDED

      public static final String STATUS_SUSPENDED
      member status: suspended (deprovisioned but account retained)
      See Also:
    • STATUS_REMOVED

      public static final String STATUS_REMOVED
      member status: removed from the team
      See Also:
    • LIFECYCLE_STATE_ACTIVE

      public static final String LIFECYCLE_STATE_ACTIVE
      lifecycle state: a normal active team member (default)
      See Also:
    • LIFECYCLE_STATE_SUSPENDED

      public static final String LIFECYCLE_STATE_SUSPENDED
      lifecycle state: suspended (deactivated, account retained on the team)
      See Also:
    • LIFECYCLE_MARKER_SUSPENDED

      public static final String LIFECYCLE_MARKER_SUSPENDED
      lifecycle marker group extension that suspends the member (under the lifecycle folder)
      See Also:
    • LIFECYCLE_MARKER_DOWNGRADE

      public static final String LIFECYCLE_MARKER_DOWNGRADE
      lifecycle marker group extension that, on deprovision, converts the member to a free Basic account (keep_account=true) instead of deleting it (under the lifecycle folder)
      See Also:
    • ADMIN_ROLE_HIERARCHY

      public static final List<String> ADMIN_ROLE_HIERARCHY
      The 8 built-in Dropbox admin roles, ordered highest-privilege first. When a member belongs to more than one admin-role group, full sync resolves to the highest tier in this list. A member in no admin-role group is member_only (a regular member with no admin rights). These names match the group extension under the configured admin-role folder.
  • Constructor Details

    • DropboxUser

      public DropboxUser()
  • Method Details

    • highestAdminRole

      public static String highestAdminRole(Collection<String> roleNames)
      Resolve the highest-privilege admin role among a set of role names, per ADMIN_ROLE_HIERARCHY. Returns null if the set is empty or contains no known role.
      Parameters:
      roleNames - candidate admin role names
      Returns:
      the highest-tier role name, or null
    • createTableDropboxUser

      public static void createTableDropboxUser(DdlVersionBean ddlVersionBean, Database database)
      Create the mock database table that simulates the Dropbox member store for tests.
      Parameters:
      ddlVersionBean - ddl version bean
      database - the database model
    • getId

      public String getId()
    • setId

      public void setId(String id)
    • getEmail

      public String getEmail()
    • setEmail

      public void setEmail(String email)
    • getExternalId

      public String getExternalId()
    • setExternalId

      public void setExternalId(String externalId)
    • getGivenName

      public String getGivenName()
    • setGivenName

      public void setGivenName(String givenName)
    • getSurname

      public String getSurname()
    • setSurname

      public void setSurname(String surname)
    • getStatus

      public String getStatus()
    • setStatus

      public void setStatus(String status)
    • getAccountId

      public String getAccountId()
    • setAccountId

      public void setAccountId(String accountId)
    • getAdminRole

      public String getAdminRole()
    • setAdminRole

      public void setAdminRole(String adminRole)
    • getLifecycleState

      public String getLifecycleState()
    • setLifecycleState

      public void setLifecycleState(String lifecycleState)
    • isLifecycleSuspended

      public boolean isLifecycleSuspended()
      Returns:
      true if the desired lifecycle state is suspended
    • isActive

      public boolean isActive()
      Returns:
      true if the member is active on the team
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fromJson

      public static DropboxUser fromJson(com.fasterxml.jackson.databind.JsonNode memberNode)
      Convert from a Dropbox member profile JSON node. Accepts either a bare TeamMemberProfile or a member_info wrapper containing a "profile" object.
      Parameters:
      memberNode - a Dropbox member JSON object
      Returns:
      the DropboxUser, or null if memberNode is null
    • toAddJson

      public com.fasterxml.jackson.databind.node.ObjectNode toAddJson()
      Build the member entry for POST /2/team/members/add_v2 (new_members array element).
      Returns:
      the new-member request object
    • toSetProfileJson

      public com.fasterxml.jackson.databind.node.ObjectNode toSetProfileJson(Set<String> fieldNamesToSet)
      Build the request body for POST /2/team/members/set_profile_v2. The member is selected by team_member_id; only the supplied new_* fields are changed.
      Parameters:
      fieldNamesToSet - field names to set, or null for all
      Returns:
      the set_profile request body
    • toUserSelectorJson

      public com.fasterxml.jackson.databind.node.ObjectNode toUserSelectorJson()
      Build a UserSelectorArg union selecting this member by team_member_id.
      Returns:
      the user selector JSON
    • toSetAdminPermissionsJson

      public com.fasterxml.jackson.databind.node.ObjectNode toSetAdminPermissionsJson(List<String> roleIds)
      Build the request body for POST /2/team/members/set_admin_permissions_v2. The member is selected by team_member_id. new_roles holds the resolved Dropbox role ids; an empty list demotes the member to member_only (no admin rights).
      Parameters:
      roleIds - the Dropbox role ids to assign (empty for member_only)
      Returns:
      the set_admin_permissions request body
    • toProvisioningEntity

      public ProvisioningEntity toProvisioningEntity()
      Convert to a Grouper provisioning entity. The provisioning entity id is the native team_member_id; matching is configured on the externalId attribute.
      Returns:
      the converted target entity
    • fromProvisioningEntity

      public static DropboxUser fromProvisioningEntity(ProvisioningEntity targetEntity, Set<String> fieldNamesToSet)
      Convert from a Grouper provisioning entity to a DropboxUser.
      Parameters:
      targetEntity - the Grouper provisioning entity
      fieldNamesToSet - field names to set, or null for all
      Returns:
      the DropboxUser