Interface SakaiProxy


  • public interface SakaiProxy
    An interface for abstracting Sakai specific parts away from the main logic.
    Author:
    Steve Swinsburg (s.swinsburg@lancaster.ac.uk)
    • Method Detail

      • getCurrentSiteId

        String getCurrentSiteId()
        Get current siteid
        Returns:
      • getCurrentUserId

        String getCurrentUserId()
        Get current user id
        Returns:
      • getCurrentUser

        org.sakaiproject.user.api.User getCurrentUser()
        Get current user
        Returns:
      • getUserEid

        String getUserEid​(String userId)
        Convert internal userid to eid (jsmith26)
        Returns:
      • getUserIdForEid

        String getUserIdForEid​(String eid)
        Convert eid to internal userid
        Returns:
      • getUserDisplayName

        String getUserDisplayName​(String userId)
        Get displayname of a given userid (internal id)
        Returns:
      • getUserFirstName

        String getUserFirstName​(String userId)
        Get firstname of a given userid (internal id)
        Returns:
      • getUserLastName

        String getUserLastName​(String userId)
        Get lastname of a given userid (internal id)
        Returns:
      • getUserEmail

        String getUserEmail​(String userId)
        Get email address for a given userid (internal id)
        Returns:
      • checkForUser

        boolean checkForUser​(String userId)
        Check if a user with the given internal id (ie 6ec73d2a-b4d9-41d2-b049-24ea5da03fca) exists
        Parameters:
        userId -
        Returns:
      • checkForUserByEid

        boolean checkForUserByEid​(String eid)
        Check if a user with the given eid (ie jsmith26) exists
        Parameters:
        userId -
        Returns:
      • isSuperUser

        boolean isSuperUser()
        Is the current user a superUser? (anyone in admin realm)
        Returns:
      • isSuperUserAndProxiedToUser

        boolean isSuperUserAndProxiedToUser​(String userId)
        Is the current user a superUser and are they performing an action on another user's profile?
        Parameters:
        userId - - userId of other user
        Returns:
      • getUserType

        String getUserType​(String userId)
        Get the type of this user's account
        Parameters:
        userId -
        Returns:
      • getUserById

        org.sakaiproject.user.api.User getUserById​(String userId)
        Get a user
        Parameters:
        userId - internal user id
        Returns:
      • getUserQuietly

        org.sakaiproject.user.api.User getUserQuietly​(String userId)
        Get the User object for the given userId.

        This will not log errors so that we can quietly use it to check if a User exists for a given profile, ie in a search result, for example.

        Parameters:
        userId -
        Returns:
      • getCurrentToolTitle

        String getCurrentToolTitle()
        Get the title of the current tool. If no current tool is set, returns 'Profile'.
        Returns:
      • getUsers

        List<org.sakaiproject.user.api.User> getUsers​(List<String> userUuids)
        Get a list of Users for the given userIds
        Parameters:
        userUuids - uuids
        Returns:
        List
      • getUuids

        List<String> getUuids​(List<org.sakaiproject.user.api.User> users)
        Get a list of uuids for each of the given Users
        Parameters:
        users - Users
        Returns:
        List of uuids
      • getSakaiPerson

        org.sakaiproject.api.common.edu.person.SakaiPerson getSakaiPerson​(String userId)
        Get a SakaiPerson for a user
        Parameters:
        userId -
        Returns:
      • getSakaiPersonJpegPhoto

        byte[] getSakaiPersonJpegPhoto​(String userId)
        Get a SakaiPerson Jpeg photo for a user. Checks UserMutableType record first, then goes for SystemMutableType if none.

        Returns null if nothing found.

        Parameters:
        userId -
        Returns:
      • getSakaiPersonImageUrl

        String getSakaiPersonImageUrl​(String userId)
        Get a SakaiPerson image URL for a user. Checks UserMutableType record first, then goes for SystemMutableType if none.

        Returns null if nothing found.

        Parameters:
        userId -
        Returns:
      • getSakaiPersonPrototype

        org.sakaiproject.api.common.edu.person.SakaiPerson getSakaiPersonPrototype()
        Get a SakaiPerson prototype if they don't have a profile.

        This is not persistable so should only be used for temporary views. Use createSakaiPerson if need persistable object for saving a profile.

        Parameters:
        userId -
        Returns:
      • createSakaiPerson

        org.sakaiproject.api.common.edu.person.SakaiPerson createSakaiPerson​(String userId)
        Create a new persistable SakaiPerson object for a user
        Parameters:
        userId -
        Returns:
      • updateSakaiPerson

        boolean updateSakaiPerson​(org.sakaiproject.api.common.edu.person.SakaiPerson sakaiPerson)
        Update a SakaiPerson object in the db.

        If you are doing this from the UI you should use the ProfileLogic.updateUserProfile method instead as it will also handle any email notifications that may be required.

        We keep this because for direct actions like converting profiles etc we dont need email notifications.

        Parameters:
        sakaiPerson -
        Returns:
      • getMaxProfilePictureSize

        int getMaxProfilePictureSize()
        Get the maximum filesize that can be uploaded (profile2.picture.max=2)
        Returns:
      • getProfileGalleryImagePath

        String getProfileGalleryImagePath​(String userId,
                                          String imageId)
        Returns the gallery resource path for the specified user and image.
        Parameters:
        userId - the ID of the user.
        imageId - the ID of the image.
        Returns:
        the gallery resource path for the specified user and image.
      • getProfileGalleryThumbnailPath

        String getProfileGalleryThumbnailPath​(String userId,
                                              String thumbnailId)
        Returns the gallery resource path for the specified user and thumbnail.
        Parameters:
        userId - the ID of the user.
        imageId - the ID of the thumbnail.
        Returns:
        the gallery resource path for the specified user and image.
      • getProfileImageResourcePath

        String getProfileImageResourcePath​(String userId,
                                           int type)
        Get the location for a profileImage given the user and type
        Parameters:
        userId -
        type -
        Returns:
      • saveFile

        boolean saveFile​(String fullResourceId,
                         String userId,
                         String fileName,
                         String mimeType,
                         byte[] fileData)
        Save a file to CHS
        Parameters:
        fullResourceId -
        userId -
        fileName -
        mimeType -
        fileData -
        Returns:
      • getResource

        MimeTypeByteArray getResource​(String resourceId)
        Retrieve a resource from ContentHosting with byte[] and mimetype
        Parameters:
        resourceId - the full resourceId of the file
      • removeResource

        boolean removeResource​(String resourceId)
        Removes the specified resource.
        Parameters:
        resourceId - the ID of the resource to remove.
        Returns:
        true if the resource is successfully removed, false if the remove operation fails.
      • searchUsers

        List<org.sakaiproject.user.api.User> searchUsers​(String search)
        Search UserDirectoryService for users that match in name or email.
        Parameters:
        search - search string.
        Returns:
        a List of User objects
      • searchExternalUsers

        List<org.sakaiproject.user.api.User> searchExternalUsers​(String search)
        Search UserDirectoryService for externally provided users that match in name or email.
        Parameters:
        search - search string.
        Returns:
        a List of User objects
      • postEvent

        void postEvent​(String event,
                       String reference,
                       boolean modify)
        Post an event to Sakai
        Parameters:
        event - name of event
        reference - reference
        modify - true if something changed, false if just access
      • sendEmail

        void sendEmail​(List<String> userIds,
                       String emailTemplateKey,
                       Map<String,​Object> replacementValues)
        Sends an email to a list of users using the email template and replacement values supplied
        Parameters:
        users - list of userIds to send to - already cleaned up for their email preferences
        emailTemplateKey - the email template
      • sendEmail

        void sendEmail​(String userId,
                       String emailTemplateKey,
                       Map<String,​Object> replacementValues)
        Sends an email to a single user using the email template and replacement values supplied
        Parameters:
        user - userId to send to - already cleaned up for their email preferences
        emailTemplateKey - the email template
      • getServiceName

        String getServiceName()
        Get the name of this Sakai installation (ie Sakai@Lancs)
        Returns:
      • getPortalUrl

        String getPortalUrl()
        Gets the portalUrl configuration parameter (ie http://sakai.lancs.ac.uk/portal) Will not work outside of /portal context (ie won't work from an entityprovider)
        Returns:
      • getServerUrl

        String getServerUrl()
        Gets the serverUrl configuration parameter (http://sakai.lancs.ac.uk:8080)
        Returns:
      • getServerName

        String getServerName()
        Get the DNS name of this Sakai server (ie sakai.lancs.ac.uk)
        Returns:
      • getUserHomeUrl

        String getUserHomeUrl()
        Get the URL to the current user's my workspace
        Returns:
      • getPortalPath

        String getPortalPath()
        Gets the portal path, generally /portal unless override in sakai.properties
        Returns:
      • isUsingNormalPortal

        boolean isUsingNormalPortal()
        Are we using the normal /portal? Deep links are broken in xsl-portal, so we need a workaround to drop the toolstate param. See PRFL-264
        Returns:
      • getFullPortalUrl

        String getFullPortalUrl()
        Gets the full portal url by adding getServerUrl() and getPortalPath() together This WILL work outside the portal context so safe to use from an entityprovider
        Returns:
      • updateEmailForUser

        void updateEmailForUser​(String userId,
                                String email)
        Updates a user's email address If the user is a provided user (ie from LDAP) this will probably fail so only internal accounts can be updated.
        Parameters:
        userId - uuid of the user
        email -
      • updateNameForUser

        void updateNameForUser​(String userId,
                               String firstName,
                               String lastName)
        Updates a user's name If the user is a provided user (ie from LDAP) this will probably fail so only internal accounts can be updated.
        Parameters:
        userId - uuid of the user
        email -
      • getDirectUrlToUserProfile

        @Deprecated
        String getDirectUrlToUserProfile​(String userId,
                                         String extraParams)
        Deprecated.
        Creates a direct URL to a user's profile page on their My Workspace Any other parameters supplied in string are appended and encoded.
        Parameters:
        userId - uuid of the user
        extraParams - any extra params to add to the query string
        Returns:
      • getDirectUrlToProfileComponent

        String getDirectUrlToProfileComponent​(String userId,
                                              String component,
                                              Map<String,​String> extraParams)
        Creates a direct URL to a component (profile, messages etc) of a user's profile page on their My Workspace
        Parameters:
        userId - uuid of the user
        component - - currently only 'viewprofile' is supported.
        extraParams - a map of params that each component may need, used to build the URL
        Returns:
      • getDirectUrlToProfileComponent

        String getDirectUrlToProfileComponent​(String viewerUuid,
                                              String viewedUuid,
                                              String component,
                                              Map<String,​String> extraParams)
        Creates a direct URL to a component (profile, messages etc) of a user's profile page from another user's My Workspace.
        Parameters:
        viewerUuid - uuid of the viewing user
        viewedUuid - uuid of the user being viewed
        component - - currently only 'viewprofile' is supported.
        extraParams - a map of params that each component may need, used to build the URL
        Returns:
      • isAccountUpdateAllowed

        boolean isAccountUpdateAllowed​(String userId)
        Check if a user is allowed to update their account. The User could come from LDAP so updates not allowed. This will check if any updates are allowed. Note userDirectoryService.allowUpdateUserEmail etc are NOT the right methods to use as they don't check if account updates are allowed, just if the user doing the update is allowed.
        Parameters:
        userId -
        Returns:
      • isBusinessProfileEnabled

        boolean isBusinessProfileEnabled()
        Is the profile2.profile.business.enabled flag set in sakai.properties? If not set, defaults to false.
        Returns:
        true if the profile2.profile.business.enabled flag is set, otherwise returns false.
      • isWallEnabledGlobally

        @Deprecated
        boolean isWallEnabledGlobally()
        Deprecated.
        Is the profile2.wall.enabled flag set in sakai.properties? If not set, defaults to false. DEPRECATED: UNLESS THERE IS AN EXPRESSED DESIRE FOR THIS FUNCTIONALITY THE WALL WILL BE REMOVED FOR 13.
        Returns:
        true if the profile2.wall.enabled flag is set, otherwise returns false.
      • isWallDefaultProfilePage

        boolean isWallDefaultProfilePage()
        Is the profile2.wall.default flag set in sakai.properties? If not set, defaults to false.
        Returns:
        true if the profile2.wall.default flag is set, otherwise returns false.
      • isProfileConversionEnabled

        boolean isProfileConversionEnabled()
        Is the profile2.convert flag set in sakai.properties? If not set, defaults to false

        This will convert profiles from the original Profile tool in Sakai, to Profile2 format. Any images that were uploaded via various methods will be placed into Sakai's ContentHostingSystem and thumbnails generated for use in various parts of Profile2.

        Returns:
      • isProfileImportEnabled

        boolean isProfileImportEnabled()
        Is the profile2.import flag set in sakai.properties? If not set, defaults to false

        This will import profiles from a csv file specified by the profile2.import.csv property

        Returns:
      • getProfileImportCsvPath

        String getProfileImportCsvPath()
        Get the path to the CSV file to import, specified by the profile2.import.csv property
        Returns:
      • isTwitterIntegrationEnabledGlobally

        boolean isTwitterIntegrationEnabledGlobally()
        Is the profile2.integration.twitter.enabled flag set in sakai.properties? If not set, defaults to true

        Depending on this setting, the UI will allow a user to input their Twitter settings and their status updates will be sent to Twitter.

        Returns:
      • getTwitterSource

        String getTwitterSource()
        Get the profile2.integration.twitter.source parameter See here: http://bugs.sakaiproject.org/confluence/display/PROFILE/Profile2
      • isProfileGalleryEnabledGlobally

        boolean isProfileGalleryEnabledGlobally()
        Is the profile2.gallery.enabled flag set in sakai.properties? If not set, default to true.
        Returns:
        the status of the profile2.gallery.enabled flag in sakai.properties. Returns true by default.
      • isProfilePictureChangeEnabled

        boolean isProfilePictureChangeEnabled()
        Is the profile2.picture.change.enabled flag set in sakai.properties? If not set, defaults to true

        Depending on this setting, users will be able to upload their own image. This can be useful to disable for institutions which may provide official photos for students.

        Returns:
      • getProfilePictureType

        int getProfilePictureType()
        Get the profile2.picture.type setting in sakai.properties

        Possible values for the sakai property are 'upload', 'url', 'official' and 'gravatar'. If not set, defaults to 'upload'.

        This returns an int which matches one of: ProfileConstants.PICTURE_SETTING_UPLOAD, ProfileConstants.PICTURE_SETTING_URL, ProfileConstants.PICTURE_SETTING_OFFICIAL, ProfileConstants.PICTURE_SETTINGS_GRAVATAR.

        Depending on this setting, Profile2 will decide how it retrieves a user's profile image, and the method by which users can add their own image. ie by uploading their own image, providing a URL, not at all (for official), or creating a gravatar URL

        Returns:
      • getAcademicEntityConfigurationSet

        List<String> getAcademicEntityConfigurationSet()
        Gets the profile2.profile.entity.set.academic list of properties that should be used in the academic profile view. Returns default list of ProfileConstants.ENTITY_SET_ACADEMIC if none.
        Returns:
      • getMinimalEntityConfigurationSet

        List<String> getMinimalEntityConfigurationSet()
        Gets the profile2.profile.entity.set.minimal list of properties that should be used in the minimal profile view. Returns default list of ProfileConstants.ENTITY_SET_MINIMAL if none.
        Returns:
      • ensureUuid

        String ensureUuid​(String userId)
        Convenience method to ensure the given userId(eid or internal id) is returned as a valid uuid.

        External integrations must pass input through this method, where the input can be either form, since all data is keyed on the internal user id.

        Parameters:
        userId -
        Returns:
        uuid or null
      • currentUserMatchesRequest

        boolean currentUserMatchesRequest​(String userUuid)
        Convenience method to check if the user making a request is the same as the current user
        Parameters:
        userUuid - uuid to check against current user
        Returns:
      • isPrivacyChangeAllowedGlobally

        boolean isPrivacyChangeAllowedGlobally()
        Is the profile2.privacy.change.enabled flag set in sakai.properties? If not set, defaults to true

        Allows an institution to lock down privacy changes as some things need to be never changed. Generally should coupled with the sakai.properties that override the default privacy settings

        Returns:
      • getOverriddenPrivacySettings

        HashMap<String,​Object> getOverriddenPrivacySettings()
        Gets the set of sakai.properties that can override the built in defaults. This is then called when a default privacy record is requested and the values used preferentially. Note that mostly the value is an Integer but for some values its a Boolean, ie checkboxes
        Returns:
      • getInvisibleUsers

        List<String> getInvisibleUsers()
        Gets the profile2.invisible.users List for user's that should never show in searches or connection lists
        Returns:
      • isConnectionAllowedBetweenUserTypes

        boolean isConnectionAllowedBetweenUserTypes​(String requestingUserType,
                                                    String targetUserType)
        Gets the list of usertypes from profile2.allowed.connection.usertypes.TYPE.

        This defines what user types can connect to each other. The requestingUserType is appended to the property string and the list retrieved. If targetUserType is in the list, they can connect (true). If not, false.

        If the property does not exist for that userType, they can connect, to maintain backward compatibility and keep it open.

        Parameters:
        requestingUserType -
        targetUserType -
        Returns:
      • toggleProfileLocked

        boolean toggleProfileLocked​(String userId,
                                    boolean locked)
        Toggle a profile's locked status.
        Parameters:
        userId -
        locked -
        Returns:
      • isOfficialImageEnabledGlobally

        boolean isOfficialImageEnabledGlobally()
        Is profile2.official.image.enabled true? If so, allow use of this image and preference.
        Returns:
      • isUsingOfficialImage

        boolean isUsingOfficialImage()
        Checks if profile2.picture.type=official
        Returns:
      • isUsingOfficialImageButAlternateSelectionEnabled

        boolean isUsingOfficialImageButAlternateSelectionEnabled()
        Checks if the conditions are appropriate for a user to be able to select whether to use the official image or an alternate of their choice
        Returns:
      • getOfficialImageSource

        String getOfficialImageSource()
        Gets the value of the profile2.official.image.source attribute from sakai.properties. If not set, defaults to ProfileConstants.OFFICIAL_SETTING_DEFAULT This should be specified if profile2.picture.type=official
        Returns:
      • getOfficialImagesDirectory

        String getOfficialImagesDirectory()
        Gets the value of the profile2.official.image.directory attribute from sakai.properties. If not set, defaults to /official-photos This should be specified if profile2.picture.type=official
        Returns:
        The root directory where official images are stored
      • getOfficialImagesFileSystemPattern

        String getOfficialImagesFileSystemPattern()
        Get the value of the profile2.official.image.directory.pattern attribute from sakai.properties. If not set, defaults to TWO_DEEP.
        Options:
        • ONE_DEEP = first letter of a user's eid, then a slash, then the eid suffixed by '.jpg'. For example BASEDIR/a/adrian.jpg, BASEDIR/s/steve.jpg
        • TWO_DEEP = first letter of a user's eid, then a slash, then the second letter of the eid followed by a slash and finally the eid suffixed by '.jpg'. For example BASEDIR/a/d/adrian.jpg, BASEDIR/s/t/steve.jpg
        • ALL_IN_ONE = all files in the one directory. For example BASEDIR/adrian.jpg, BASEDIR/steve.jpg
        This is optional but if you have your images on the filesystem in a pattern that isnt default, you need to set a pattern.
        Returns:
      • getOfficialImageAttribute

        String getOfficialImageAttribute()
        Gets the value of the profile2.official.image.attribute from sakai.properties If not set, defaults to ProfileConstants.USER_PROPERTY_JPEG_PHOTO This should be specified if profile2.official.image.source=provided
        Returns:
      • createUuid

        String createUuid()
        Get a UUID from the IdManager
        Returns:
      • isUserActive

        boolean isUserActive​(String userUuid)
        Does the user have a current Sakai session
        Parameters:
        userUuid - user to check
        Returns:
        true/false
      • getActiveUsers

        List<String> getActiveUsers​(List<String> userUuids)
        Get the list of users with active Sakai sessions, given the supplied list of userIds.
        Parameters:
        userUuids - List of users to check
        Returns:
        List of userUuids that have active Sakai sessions
      • getLastEventTimeForUser

        Long getLastEventTimeForUser​(String userUuid)
        Get the last event time for the user.
        Parameters:
        userUuid - user to check
        Returns:
        Long of time in milliseconds since epoch, or null if no event.
      • getLastEventTimeForUsers

        Map<String,​Long> getLastEventTimeForUsers​(List<String> userUuids)
        Get the last event time for each of the given users
        Parameters:
        userUuids - users to check
        Returns:
        Map of userId to Long of time in milliseconds since epoch, or null if no event.
      • getServerConfigurationParameter

        String getServerConfigurationParameter​(String key,
                                               String def)
        Generic method to get a configuration parameter from sakai.properties
        Parameters:
        key - key of property
        def - default value
        Returns:
        value or default if none
      • isUserMyWorkspace

        boolean isUserMyWorkspace​(String siteId)
        Check if specified site is a My Workspace site
        Parameters:
        siteId - id of site
        Returns:
        true if site is a My Workspace site, false otherwise.
      • isUserAllowedInSite

        boolean isUserAllowedInSite​(String userId,
                                    String permission,
                                    String siteId)
        Generic method to check if user has permission in site
        Parameters:
        userId - userId of user to check permission
        permission - the permission to check in site
        siteId - site id
        Returns:
      • checkForSite

        boolean checkForSite​(String siteId)
        Check if the given siteid is valid
        Parameters:
        siteId -
        Returns:
      • getMaxSearchResults

        int getMaxSearchResults()
        Get the profile2.search.maxSearchResults value from sakai.properties
      • getMaxSearchResultsPerPage

        int getMaxSearchResultsPerPage()
        Get the profile2.search.maxSearchResultsPerPage value from sakai.properties
      • isGravatarImageEnabledGlobally

        boolean isGravatarImageEnabledGlobally()
        Is profile2.gravatar.image.enabled true? If so, allow use of this image and preference.
        Returns:
      • isUserAllowedAddSite

        boolean isUserAllowedAddSite​(String userUuid)
        Does user have site.add permission?
        Returns:
        true if user allowed to create worksites, else false.
      • addSite

        org.sakaiproject.site.api.Site addSite​(String id,
                                               String type)
        Add a new site.
        Parameters:
        id - the id of the site.
        type - the type of the site e.g. project.
        Returns:
        a reference to the new site or null if there is a problem creating the site.
      • saveSite

        boolean saveSite​(org.sakaiproject.site.api.Site site)
        Save an existing site.
        Parameters:
        site - a reference to the site to save.
        Returns:
        true if successful, otherwise false.
      • getSite

        org.sakaiproject.site.api.Site getSite​(String siteId)
        Return a reference to the specified site.
        Parameters:
        siteId -
        Returns:
        a reference to the specified site.
      • getUserSites

        List<org.sakaiproject.site.api.Site> getUserSites()
        Return all user sites for the current user (i.e. worksites that the user has at least 'access' permission to).
        Returns:
        all user sites for the current user.
      • getTool

        org.sakaiproject.tool.api.Tool getTool​(String id)
        Returns a reference to the specified Sakai tool.
        Parameters:
        id - the id of the tool required.
        Returns:
        a reference to the specified Sakai tool or null if a reference cannot be obtained.
      • getToolsRequired

        List<String> getToolsRequired​(String category)
        Returns a list of the tool types required for the specified site type.
        Parameters:
        category - the type of site e.g. 'project'
        Returns:
        a list of the tool types required for the specified site type
      • isGoogleIntegrationEnabledGlobally

        boolean isGoogleIntegrationEnabledGlobally()
        Is the profile2.integration.google.enabled flag set to true in sakai.properties? If not set, defaults to false

        Depending on this setting, the UI will allow a user to add their Google account. For institutions to use this there additional setup required.

        Returns:
      • isLoggedIn

        boolean isLoggedIn()
        Helper to check if the current user is logged in
        Returns:
      • isProfileFieldsEnabled

        boolean isProfileFieldsEnabled()
        Is the profile2.profile.fields.enabled flag set in sakai.properties? If not set, defaults to true.

        This setting controls the display of the profile fields.

        Returns:
        true or false.
      • isProfileStatusEnabled

        boolean isProfileStatusEnabled()
        Is the profile2.profile.status.enabled flag set in sakai.properties? If not set, defaults to true.

        This setting controls the display of the profile status section.

        Returns:
        true or false.
      • isSocialProfileEnabled

        boolean isSocialProfileEnabled()
        Is the profile2.profile.social.enabled flag set in sakai.properties? If not set, defaults to true.
        Returns:
        true if the profile2.profile.social.enabled flag is set, otherwise returns false.
      • isInterestsProfileEnabled

        boolean isInterestsProfileEnabled()
        Is the profile2.profile.interests.enabled flag set in sakai.properties? If not set, defaults to true.
        Returns:
        true if the profile2.profile.interests.enabled flag is set, otherwise returns false.
      • isStaffProfileEnabled

        boolean isStaffProfileEnabled()
        Is the profile2.profile.staff.enabled flag set in sakai.properties? If not set, defaults to true.
        Returns:
        true if the profile2.profile.staff.enabled flag is set, otherwise returns false.
      • isStudentProfileEnabled

        boolean isStudentProfileEnabled()
        Is the profile2.profile.student.enabled flag set in sakai.properties? If not set, defaults to true.
        Returns:
        true if the profile2.profile.student.enabled flag is set, otherwise returns false.
      • isNamePronunciationProfileEnabled

        boolean isNamePronunciationProfileEnabled()
        Is the profile2.profile.name.pronunciation.enabled flag set in sakai.properties? If not set, defaults to true
        Returns:
        true if the profile2.profile.name.pronunciation.enabled flag is set, otherwise returns false.
      • isProfileImageImportEnabled

        boolean isProfileImageImportEnabled()
        Is the profile2.import.images flag set in sakai.properties? If not set, defaults to false

        If enabled then at startup profile 2 will attempt to download any profile URLs set and upload them as profile images.

        Returns:
        true or false
      • isMenuEnabledGlobally

        boolean isMenuEnabledGlobally()
        Is the profile2.menu.enabled flag set in sakai.properties? If not set, defaults to true.

        If enabled, the profile sub-sections will be displayed. This setting controls the display of the profile sub-sections: * Messaging * Privacy * Gallery * Preferences * Search * Messaging * Connections

        Returns:
        true if the profile2.menu.enabled flag is set, otherwise returns false.
      • isConnectionsEnabledGlobally

        boolean isConnectionsEnabledGlobally()
        Is the profile2.connections.enabled flag set in sakai.properties? If not set, defaults to true.

        If enabled, the connection feature will be available.

        Returns:
        true if the profile2.connections.enabled flag is set, otherwise returns false.
      • isMessagingEnabledGlobally

        boolean isMessagingEnabledGlobally()
        Is the profile2.messaging.enabled flag set in sakai.properties? If not set, default to true, as long as profile2.connections.enabled is true.

        If enabled, the messaging feature will be enabled. Though, Messaging depends on Connections, thus if ConnectionsEnabled == false, Messaging will also be false.

        Returns:
        the status of the profile2.messaging.enabled flag in sakai.properties. Returns true by default.
      • isSearchEnabledGlobally

        boolean isSearchEnabledGlobally()
        Is the profile2.search.enabled flag set in sakai.properties? If not set, defaults to true.

        If enabled, the ability to search for people in profile will be available.

        Returns:
        true if the profile2.search.enabled flag is set, otherwise returns false.
      • isPrivacyEnabledGlobally

        boolean isPrivacyEnabledGlobally()
        Is the profile2.privacy.enabled flag set in sakai.properties? If not set, defaults to true.

        If enabled, the ability to modify one's privacy settings in profile will be available. Set profile2.privacy.default.x appropriately if disabled

        Returns:
        true if the profile2.privacy.enabled flag is set, otherwise returns false.
      • isPreferenceEnabledGlobally

        boolean isPreferenceEnabledGlobally()
        Is the profile2.preference.enabled flag set in sakai.properties? If not set, defaults to true.

        If enabled, the ability to modify one's preferences within profile will be available.

        Returns:
        true if the profile2.preference.enabled flag is set, otherwise returns false.
      • isMyKudosEnabledGlobally

        boolean isMyKudosEnabledGlobally()
        Is the profile2.myKudos.enabled flag set in sakai.properties? If not set, defaults to true.

        If enabled, the Kudos feature will be displayed.

        Returns:
        true if the profile2.myKudos.enabled flag is set, otherwise returns false.
      • isOnlineStatusEnabledGlobally

        boolean isOnlineStatusEnabledGlobally()
        Is the profile2.onlineStatus.enabled flag set in sakai.properties? If not set, defaults to true.

        If enabled, an online indicator will be present when viewing a profile.

        Returns:
        true if the profile2.onlineStatus.enabled flag is set, otherwise returns false.
      • validateSiteTitle

        org.sakaiproject.site.api.SiteService.SiteTitleValidationStatus validateSiteTitle​(String orig,
                                                                                          String stripped)
        Given the original and stripped site titles, determine that validation status of the stripped string.
        Parameters:
        orig - the original, unaltered text as input by the user
        stripped - the HTML stripped text
        Returns:
        SiteService.SiteTitleValidationStatus
      • getNamePronunciationExamplesLink

        String getNamePronunciationExamplesLink()
        Returns the name pronunciation examples link
        Returns:
        the name pronunciation examples link, empty if it is not configured in sakai.properties
      • getNamePronunciationDuration

        int getNamePronunciationDuration()
        Returns the name pronunciation duration in seconds
        Returns:
        the name pronunciation duration in seconds. 10 seconds if it is not configured in sakai.properties
      • isUserMemberOfSite

        boolean isUserMemberOfSite​(String userId,
                                   String siteId)
        Check if a user is member of a site
        Parameters:
        userId - userId of user to check membership
        siteId - id of site
        Returns:
        true if the user is member of that site
      • areUsersMembersOfSameSite

        boolean areUsersMembersOfSameSite​(String userId1,
                                          String userId2)
        Check if two users have any site membership in common
        Parameters:
        userId1 - userId of user to check membership
        userId2 - userId of user to check membership
        Returns:
        true if both users are members of one common site