org.sakaiproject.profile2.logic
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 Summary
 org.sakaiproject.site.api.Site addSite(String id, String type)
          Add a new site.
 boolean checkForSite(String siteId)
          Check if the given siteid is valid
 boolean checkForUser(String userId)
          Check if a user with the given internal id (ie 6ec73d2a-b4d9-41d2-b049-24ea5da03fca) exists
 boolean checkForUserByEid(String eid)
          Check if a user with the given eid (ie jsmith26) exists
 org.sakaiproject.api.common.edu.person.SakaiPerson createSakaiPerson(String userId)
          Create a new persistable SakaiPerson object for a user
 String createUuid()
          Get a UUID from the IdManager
 boolean currentUserMatchesRequest(String userUuid)
          Convenience method to check if the user making a request is the same as the current user
 String ensureUuid(String userId)
          Convenience method to ensure the given userId(eid or internal id) is returned as a valid uuid.
 List<String> getAcademicEntityConfigurationSet()
          Gets the profile2.profile.entity.set.academic list of properties that should be used in the academic profile view.
 List<String> getActiveUsers(List<String> userUuids)
          Get the list of users with active Sakai sessions, given the supplied list of userIds.
 String getCurrentSiteId()
          Get current siteid
 String getCurrentToolTitle()
          Get the title of the current tool.
 org.sakaiproject.user.api.User getCurrentUser()
          Get current user
 String getCurrentUserId()
          Get current user id
 String getDirectUrlToUserProfile(String userId, String extraParams)
          Creates a direct URL to a user's profile page on their My Workspace Any other parameters supplied in string are appended and encoded.
 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
 List<String> getInvisibleUsers()
          Gets the profile2.invisible.users List for user's that should never show in searches or connection lists
 Long getLastEventTimeForUser(String userUuid)
          Get the last event time for the user.
 Map<String,Long> getLastEventTimeForUsers(List<String> userUuids)
          Get the last event time for each of the given users
 int getMaxProfilePictureSize()
          Get the maximum filesize that can be uploaded (profile2.picture.max=2)
 int getMaxSearchResults()
          Get the profile2.search.maxSearchResults value from sakai.properties
 int getMaxSearchResultsPerPage()
          Get the profile2.search.maxSearchResultsPerPage value from sakai.properties
 List<String> getMinimalEntityConfigurationSet()
          Gets the profile2.profile.entity.set.minimal list of properties that should be used in the minimal profile view.
 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
 String getOfficialImageSource()
          Gets the value of the profile2.official.image.source attribute from sakai.properties.
 HashMap<String,Object> getOverriddenPrivacySettings()
          Gets the set of sakai.properties that can override the built in defaults.
 String getPortalPath()
          Gets the portal path, generally /portal unless override in sakai.properties
 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)
 String getProfileGalleryImagePath(String userId, String imageId)
          Returns the gallery resource path for the specified user and image.
 String getProfileGalleryThumbnailPath(String userId, String thumbnailId)
          Returns the gallery resource path for the specified user and thumbnail.
 String getProfileImageResourcePath(String userId, int type)
          Get the location for a profileImage given the user and type
 String getProfileImportCsvPath()
          Get the path to the CSV file to import, specified by the profile2.import.csv property
 int getProfilePictureType()
          Get the profile2.picture.type setting in sakai.properties
 MimeTypeByteArray getResource(String resourceId)
          Retrieve a resource from ContentHosting with byte[] and mimetype
 org.sakaiproject.api.common.edu.person.SakaiPerson getSakaiPerson(String userId)
          Get a SakaiPerson for a user
 String getSakaiPersonImageUrl(String userId)
          Get a SakaiPerson image URL for a user.
 byte[] getSakaiPersonJpegPhoto(String userId)
          Get a SakaiPerson Jpeg photo for a user.
 org.sakaiproject.api.common.edu.person.SakaiPerson getSakaiPersonPrototype()
          Get a SakaiPerson prototype if they don't have a profile.
 String getServerConfigurationParameter(String key, String def)
          Generic method to get a configuration parameter from sakai.properties
 String getServerName()
          Get the DNS name of this Sakai server (ie sakai.lancs.ac.uk)
 String getServerUrl()
          Gets the serverUrl configuration parameter (http://sakai.lancs.ac.uk:8080)
 String getServiceName()
          Get the name of this Sakai installation (ie Sakai@Lancs)
 org.sakaiproject.site.api.Site getSite(String siteId)
          Return a reference to the specified site.
 String getSkinRepoProperty()
          Wrapper for ServerConfigurationService.getString("skin.repo")
 org.sakaiproject.tool.api.Tool getTool(String id)
          Returns a reference to the specified Sakai tool.
 String getToolSkinCSS(String skinRepo)
          Gets the tool skin CSS first by checking the tool, otherwise by using the default property.
 List<String> getToolsRequired(String category)
          Returns a list of the tool types required for the specified site type.
 String getTwitterSource()
          Get the profile2.integration.twitter.source parameter See here: http://bugs.sakaiproject.org/confluence/display/PROFILE/Profile2
 org.sakaiproject.user.api.User getUserById(String userId)
          Get a user
 String getUserDisplayName(String userId)
          Get displayname of a given userid (internal id)
 String getUserEid(String userId)
          Convert internal userid to eid (jsmith26)
 String getUserEmail(String userId)
          Get email address for a given userid (internal id)
 String getUserFirstName(String userId)
          Get firstname of a given userid (internal id)
 String getUserHomeUrl()
          Get the URL to the current user's my workspace
 String getUserIdForEid(String eid)
          Convert eid to internal userid
 String getUserLastName(String userId)
          Get lastname of a given userid (internal id)
 org.sakaiproject.user.api.User getUserQuietly(String userId)
          Get the User object for the given userId.
 List<org.sakaiproject.user.api.User> getUsers(List<String> userUuids)
          Get a list of Users for the given userIds
 List<org.sakaiproject.site.api.Site> getUserSites()
          Return all user sites for the current user (i.e.
 String getUserType(String userId)
          Get the type of this user's account
 List<String> getUuids(List<org.sakaiproject.user.api.User> users)
          Get a list of uuids for each of the given Users
 boolean isAccountUpdateAllowed(String userId)
          Check if a user is allowed to update their account.
 boolean isAdminUser()
          Is the current user the admin user? (ie 'admin')
 boolean isBusinessProfileEnabled()
          Is the profile2.profile.business.enabled flag set in sakai.properties? If not set, defaults to false.
 boolean isConnectionAllowedBetweenUserTypes(String requestingUserType, String targetUserType)
          Gets the list of usertypes from profile2.allowed.connection.usertypes.TYPE.
 boolean isGoogleIntegrationEnabledGlobally()
          Is the profile2.integration.google.enabled flag set to true in sakai.properties? If not set, defaults to false
 boolean isGravatarImageEnabledGlobally()
          Is profile2.gravatar.image.enabled true? If so, allow use of this image and preference.
 boolean isLoggedIn()
          Helper to check if the current user is logged in
 boolean isOfficialImageEnabledGlobally()
          Is profile2.official.image.enabled true? If so, allow use of this image and preference.
 boolean isPrivacyChangeAllowedGlobally()
          Is the profile2.privacy.change.enabled flag set in sakai.properties? If not set, defaults to true
 boolean isProfileConversionEnabled()
          Is the profile2.convert flag set in sakai.properties? If not set, defaults to false
 boolean isProfileGalleryEnabledGlobally()
          Is the profile2.gallery.enabled flag set in sakai.properties? If not set, default to true.
 boolean isProfileImportEnabled()
          Is the profile2.import flag set in sakai.properties? If not set, defaults to false
 boolean isProfilePictureChangeEnabled()
          Is the profile2.picture.change.enabled flag set in sakai.properties? If not set, defaults to true
 boolean isSuperUser()
          Is the current user a superUser? (anyone in admin realm)
 boolean isSuperUserAndProxiedToUser(String userId)
          Is the current user a superUser and are they performing an action on another user's profile?
 boolean isTwitterIntegrationEnabledGlobally()
          Is the profile2.integration.twitter.enabled flag set in sakai.properties? If not set, defaults to true
 boolean isUserActive(String userUuid)
          Does the user have a current Sakai session
 boolean isUserAllowedAddSite(String userUuid)
          Does user have site.add permission?
 boolean isUserAllowedInSite(String userId, String permission, String siteId)
          Generic method to check if user has permission in site
 boolean isUserMyWorkspace(String siteId)
          Check if specified site is a My Workspace site
 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.
 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
 boolean isWallDefaultProfilePage()
          Is the profile2.wall.default flag set in sakai.properties? If not set, defaults to false.
 boolean isWallEnabledGlobally()
          Is the profile2.wall.enabled flag set in sakai.properties? If not set, defaults to false.
 void postEvent(String event, String reference, boolean modify)
          Post an event to Sakai
 boolean removeResource(String resourceId)
          Removes the specified resource.
 boolean saveFile(String fullResourceId, String userId, String fileName, String mimeType, byte[] fileData)
          Save a file to CHS
 boolean saveSite(org.sakaiproject.site.api.Site site)
          Save an existing site.
 List<org.sakaiproject.user.api.User> searchExternalUsers(String search)
          Search UserDirectoryService for externally provided users that match in name or email.
 List<org.sakaiproject.user.api.User> searchUsers(String search)
          Search UserDirectoryService for users that match in name or email.
 void sendEmail(List<String> userIds, String emailTemplateKey, Map<String,String> replacementValues)
          Sends an email to a list of users using the email template and replacement values supplied
 void sendEmail(String userId, String emailTemplateKey, Map<String,String> replacementValues)
          Sends an email to a single user using the email template and replacement values supplied
 void sendEmail(String userId, String subject, String message)
          Send an email message.
 boolean toggleProfileLocked(String userId, boolean locked)
          Toggle a profile's locked status.
 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.
 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.
 boolean updateSakaiPerson(org.sakaiproject.api.common.edu.person.SakaiPerson sakaiPerson)
          Update a SakaiPerson object in the db.
 

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:

isAdminUser

boolean isAdminUser()
Is the current user the admin user? (ie 'admin')

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(String userId,
               String subject,
               String message)
Send an email message. The message should be ready to go as is. The message will be formatted with mime boundaries, html escaped then sent.

Parameters:
userId - userId to send the message to
subject - subject of message
message - complete with newlines and any links.

sendEmail

void sendEmail(List<String> userIds,
               String emailTemplateKey,
               Map<String,String> 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,String> 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

String getDirectUrlToUserProfile(String userId,
                                 String extraParams)
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:

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

boolean isWallEnabledGlobally()
Is the profile2.wall.enabled flag set in sakai.properties? If not set, defaults to false.

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:

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:

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:

getSkinRepoProperty

String getSkinRepoProperty()
Wrapper for ServerConfigurationService.getString("skin.repo")

Returns:

getToolSkinCSS

String getToolSkinCSS(String skinRepo)
Gets the tool skin CSS first by checking the tool, otherwise by using the default property.

Parameters:
the - location of the skin repo
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:


Copyright © 2008-2013 The Sakai Foundation. All Rights Reserved.