Team synchronization

User role strategy

In order to fine-tune the behavior of the synchronization of users with Moovapps Team, it can be useful to customize the way roles are assigned when users are synchronized.

Implementation

Extension class

New in Workplace10 version. You can now modify the property of your Team User in your extension class.
The method “getRoleForTeamUser” has been deprecated, and a new method"computeTeamUser" has been implemented.
The method “getRoleForTeamUser” will be removed in a future version

You must create a class that extends com.moovapps.workplace.sdk.team.synchronization.BaseTeamUserDataRetrieval

Your class can override the following method :

  • computeTeamUser

By doing so, you can customize the way roles are assigned based on the user and your assignment logic.
The roles managed by team are accessible through the methods : getDefaultRoleCollaborator() and getDefaultRoleGuest().

The value of the roles are defined by the following configuration keys :

  • com.moovapps.team.synchronization.user.default.role.collaborator
  • com.moovapps.team.synchronization.user.default.role.guest

With his extension, you have access to the following properties :

Property Managed on creation Managed on Update Description Example
Type Yes No type d’utilisateur moovapps-process
Role Yes No Moovapps Team Role ROLE_COLLABORATOR or ROLE_GUEST
Email Yes Yes user email user@company.com
FirstName Yes Yes user firstname FirstName
LastName Yes Yes user lastName LastName
Locale Yes Yes user locale fr-FR
MobileNumber Yes Yes user mobile phone 0123456789
PhoneNumber Yes Yes user mobile phone 0623456789
AdDomain Yes Yes user Domain Workplace
Picture Yes Yes user avatar image URL
Timezone Yes Yes user timezone Europe/Paris
Disabled Yes Yes true if user is disabled / false otherwise false

type and adDomain properties must be handled with care. If these attributes are not set correctly, the user may not be able to connect on Moovapps Team.

The properties “Type” and “Role” can be initialized only at the creation of the user
In an update, they will be overwritten by the previous value
The role can be changed directly in the Team administration

Extension class declaration

You need to declare your class in a properties file with the key com.moovapps.team.synchronization.user.data.retrieval.strategy

Exemple

Exemple of a custom implementation :

public class CustomTeamUserDataRetrievalExtension extends BaseTeamUserDataRetrieval {

    /**
     * Constructor
     * @param user
     */
    public DefaultTeamUserDataRetrieval(IUser user) {
      super(user);
    }

    @Override
    public ITeamUserCustomization computeTeamUser(ITeamUserCustomization iTeamUserCustomization, IUser user) {
      iTeamUserCustomization = super.computeTeamUser(iTeamUserCustomization, user);
      String role = WorkplaceModuleFactory.getWorkplaceModule().isInOrganizationType(this.user, OrganizationType.INTERNAL) ? getDefaultRoleCollaborator() : getDefaultRoleGuest();
      iTeamUserCustomization.setRole(role);
      iTeamUserCustomization.setPhoneNumber("0412345678");
      iTeamUserCustomization.setMobileNumber("0612345678");
      iTeamUserCustomization.setFirstName("Rick");
      iTeamUserCustomization.setLastName("Deckard");
      iTeamUserCustomization.setDisabled(true);
	  iTeamUserCustomization.setLocale("en-US");
      return iTeamUserCustomization; 
    }
}

Team synchronization extension

In order to fine-tune the behavior of the synchronization of users with Moovapps Team, it can be useful to do actions before or after the synchronization.

Implementation

Extension class

You must create a class that extends com.moovapps.workplace.team.sdk.base.BaseTeamUserSynchronizerExtension

Your class can override the following methods :

  • onBeforeSynchronize
  • onAfterSynchronize
  • onSynchronizeException

By doing so, you can add the desired behavior before a user is synchronized, after a user is synchronized or in case an exception occurs during synchronization.

Extension class declaration

You need to declare your class in a properties file with the key com.moovapps.team.synchronization.user.extension.classes