Interface SakaiProxy
-
public interface SakaiProxyAn interface for abstracting Sakai specific parts away from the main logic.- Author:
- Steve Swinsburg (s.swinsburg@lancaster.ac.uk)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description org.sakaiproject.site.api.SiteaddSite(String id, String type)Add a new site.booleanareUsersMembersOfSameSite(String userId1, String userId2)Check if two users have any site membership in commonbooleancheckForSite(String siteId)Check if the given siteid is validbooleancheckForUser(String userId)Check if a user with the given internal id (ie 6ec73d2a-b4d9-41d2-b049-24ea5da03fca) existsbooleancheckForUserByEid(String eid)Check if a user with the given eid (ie jsmith26) existsorg.sakaiproject.api.common.edu.person.SakaiPersoncreateSakaiPerson(String userId)Create a new persistable SakaiPerson object for a userStringcreateUuid()Get a UUID from the IdManagerbooleancurrentUserMatchesRequest(String userUuid)Convenience method to check if the user making a request is the same as the current userStringensureUuid(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.StringgetCurrentSiteId()Get current siteidStringgetCurrentToolTitle()Get the title of the current tool.org.sakaiproject.user.api.UsergetCurrentUser()Get current userStringgetCurrentUserId()Get current user idStringgetDirectUrlToProfileComponent(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.StringgetDirectUrlToProfileComponent(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 WorkspaceStringgetDirectUrlToUserProfile(String userId, String extraParams)Deprecated.StringgetFullPortalUrl()Gets the full portal url by adding getServerUrl() and getPortalPath() together This WILL work outside the portal context so safe to use from an entityproviderList<String>getInvisibleUsers()Gets the profile2.invisible.users List for user's that should never show in searches or connection listsLonggetLastEventTimeForUser(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 usersintgetMaxProfilePictureSize()Get the maximum filesize that can be uploaded (profile2.picture.max=2)intgetMaxSearchResults()Get the profile2.search.maxSearchResults value from sakai.propertiesintgetMaxSearchResultsPerPage()Get the profile2.search.maxSearchResultsPerPage value from sakai.propertiesList<String>getMinimalEntityConfigurationSet()Gets the profile2.profile.entity.set.minimal list of properties that should be used in the minimal profile view.intgetNamePronunciationDuration()Returns the name pronunciation duration in secondsStringgetNamePronunciationExamplesLink()Returns the name pronunciation examples linkStringgetOfficialImageAttribute()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=providedStringgetOfficialImagesDirectory()Gets the value of the profile2.official.image.directory attribute from sakai.properties.StringgetOfficialImagesFileSystemPattern()Get the value of the profile2.official.image.directory.pattern attribute from sakai.properties.StringgetOfficialImageSource()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.StringgetPortalPath()Gets the portal path, generally /portal unless override in sakai.propertiesStringgetPortalUrl()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)StringgetProfileGalleryImagePath(String userId, String imageId)Returns the gallery resource path for the specified user and image.StringgetProfileGalleryThumbnailPath(String userId, String thumbnailId)Returns the gallery resource path for the specified user and thumbnail.StringgetProfileImageResourcePath(String userId, int type)Get the location for a profileImage given the user and typeStringgetProfileImportCsvPath()Get the path to the CSV file to import, specified by the profile2.import.csv propertyintgetProfilePictureType()Get the profile2.picture.type setting in sakai.propertiesMimeTypeByteArraygetResource(String resourceId)Retrieve a resource from ContentHosting with byte[] and mimetypeorg.sakaiproject.api.common.edu.person.SakaiPersongetSakaiPerson(String userId)Get a SakaiPerson for a userStringgetSakaiPersonImageUrl(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.SakaiPersongetSakaiPersonPrototype()Get a SakaiPerson prototype if they don't have a profile.StringgetServerConfigurationParameter(String key, String def)Generic method to get a configuration parameter from sakai.propertiesStringgetServerName()Get the DNS name of this Sakai server (ie sakai.lancs.ac.uk)StringgetServerUrl()Gets the serverUrl configuration parameter (http://sakai.lancs.ac.uk:8080)StringgetServiceName()Get the name of this Sakai installation (ie Sakai@Lancs)org.sakaiproject.site.api.SitegetSite(String siteId)Return a reference to the specified site.org.sakaiproject.tool.api.ToolgetTool(String id)Returns a reference to the specified Sakai tool.List<String>getToolsRequired(String category)Returns a list of the tool types required for the specified site type.StringgetTwitterSource()Get the profile2.integration.twitter.source parameter See here: http://bugs.sakaiproject.org/confluence/display/PROFILE/Profile2org.sakaiproject.user.api.UsergetUserById(String userId)Get a userStringgetUserDisplayName(String userId)Get displayname of a given userid (internal id)StringgetUserEid(String userId)Convert internal userid to eid (jsmith26)StringgetUserEmail(String userId)Get email address for a given userid (internal id)StringgetUserFirstName(String userId)Get firstname of a given userid (internal id)StringgetUserHomeUrl()Get the URL to the current user's my workspaceStringgetUserIdForEid(String eid)Convert eid to internal useridStringgetUserLastName(String userId)Get lastname of a given userid (internal id)org.sakaiproject.user.api.UsergetUserQuietly(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 userIdsList<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).StringgetUserType(String userId)Get the type of this user's accountList<String>getUuids(List<org.sakaiproject.user.api.User> users)Get a list of uuids for each of the given UsersbooleanisAccountUpdateAllowed(String userId)Check if a user is allowed to update their account.booleanisBusinessProfileEnabled()Is the profile2.profile.business.enabled flag set in sakai.properties?booleanisConnectionAllowedBetweenUserTypes(String requestingUserType, String targetUserType)Gets the list of usertypes from profile2.allowed.connection.usertypes.TYPE.booleanisConnectionsEnabledGlobally()Is the profile2.connections.enabled flag set in sakai.properties?booleanisGoogleIntegrationEnabledGlobally()Is the profile2.integration.google.enabled flag set to true in sakai.properties?booleanisGravatarImageEnabledGlobally()Is profile2.gravatar.image.enabled true?booleanisInterestsProfileEnabled()Is the profile2.profile.interests.enabled flag set in sakai.properties?booleanisLoggedIn()Helper to check if the current user is logged inbooleanisMenuEnabledGlobally()Is the profile2.menu.enabled flag set in sakai.properties?booleanisMessagingEnabledGlobally()Is the profile2.messaging.enabled flag set in sakai.properties?booleanisMyKudosEnabledGlobally()Is the profile2.myKudos.enabled flag set in sakai.properties?booleanisNamePronunciationProfileEnabled()Is the profile2.profile.name.pronunciation.enabled flag set in sakai.properties?booleanisOfficialImageEnabledGlobally()Is profile2.official.image.enabled true?booleanisOnlineStatusEnabledGlobally()Is the profile2.onlineStatus.enabled flag set in sakai.properties?booleanisPreferenceEnabledGlobally()Is the profile2.preference.enabled flag set in sakai.properties?booleanisPrivacyChangeAllowedGlobally()Is the profile2.privacy.change.enabled flag set in sakai.properties?booleanisPrivacyEnabledGlobally()Is the profile2.privacy.enabled flag set in sakai.properties?booleanisProfileConversionEnabled()Is the profile2.convert flag set in sakai.properties?booleanisProfileFieldsEnabled()Is the profile2.profile.fields.enabled flag set in sakai.properties?booleanisProfileGalleryEnabledGlobally()Is the profile2.gallery.enabled flag set in sakai.properties?booleanisProfileImageImportEnabled()Is the profile2.import.images flag set in sakai.properties?booleanisProfileImportEnabled()Is the profile2.import flag set in sakai.properties?booleanisProfilePictureChangeEnabled()Is the profile2.picture.change.enabled flag set in sakai.properties?booleanisProfileStatusEnabled()Is the profile2.profile.status.enabled flag set in sakai.properties?booleanisSearchEnabledGlobally()Is the profile2.search.enabled flag set in sakai.properties?booleanisSocialProfileEnabled()Is the profile2.profile.social.enabled flag set in sakai.properties?booleanisStaffProfileEnabled()Is the profile2.profile.staff.enabled flag set in sakai.properties?booleanisStudentProfileEnabled()Is the profile2.profile.student.enabled flag set in sakai.properties?booleanisSuperUser()Is the current user a superUser?booleanisSuperUserAndProxiedToUser(String userId)Is the current user a superUser and are they performing an action on another user's profile?booleanisTwitterIntegrationEnabledGlobally()Is the profile2.integration.twitter.enabled flag set in sakai.properties?booleanisUserActive(String userUuid)Does the user have a current Sakai sessionbooleanisUserAllowedAddSite(String userUuid)Does user have site.add permission?booleanisUserAllowedInSite(String userId, String permission, String siteId)Generic method to check if user has permission in sitebooleanisUserMemberOfSite(String userId, String siteId)Check if a user is member of a sitebooleanisUserMyWorkspace(String siteId)Check if specified site is a My Workspace sitebooleanisUsingNormalPortal()Are we using the normal /portal?booleanisUsingOfficialImage()Checks if profile2.picture.type=officialbooleanisUsingOfficialImageButAlternateSelectionEnabled()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 choicebooleanisWallDefaultProfilePage()Is the profile2.wall.default flag set in sakai.properties?booleanisWallEnabledGlobally()Deprecated.voidpostEvent(String event, String reference, boolean modify)Post an event to SakaibooleanremoveResource(String resourceId)Removes the specified resource.booleansaveFile(String fullResourceId, String userId, String fileName, String mimeType, byte[] fileData)Save a file to CHSbooleansaveSite(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.voidsendEmail(String userId, String emailTemplateKey, Map<String,Object> replacementValues)Sends an email to a single user using the email template and replacement values suppliedvoidsendEmail(List<String> userIds, String emailTemplateKey, Map<String,Object> replacementValues)Sends an email to a list of users using the email template and replacement values suppliedbooleantoggleProfileLocked(String userId, boolean locked)Toggle a profile's locked status.voidupdateEmailForUser(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.voidupdateNameForUser(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.booleanupdateSakaiPerson(org.sakaiproject.api.common.edu.person.SakaiPerson sakaiPerson)Update a SakaiPerson object in the db.org.sakaiproject.site.api.SiteService.SiteTitleValidationStatusvalidateSiteTitle(String orig, String stripped)Given the original and stripped site titles, determine that validation status of the stripped string.
-
-
-
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:
-
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.updateUserProfilemethod 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:
trueif the resource is successfully removed,falseif 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 eventreference- referencemodify- 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 preferencesemailTemplateKey- 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 preferencesemailTemplateKey- 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 useremail-
-
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 useremail-
-
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 userextraParams- 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 usercomponent- - 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 userviewedUuid- uuid of the user being viewedcomponent- - 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 tofalse.- Returns:
trueif the profile2.profile.business.enabled flag is set, otherwise returnsfalse.
-
isWallEnabledGlobally
@Deprecated boolean isWallEnabledGlobally()
Deprecated.Is the profile2.wall.enabled flag set in sakai.properties? If not set, defaults tofalse. DEPRECATED: UNLESS THERE IS AN EXPRESSED DESIRE FOR THIS FUNCTIONALITY THE WALL WILL BE REMOVED FOR 13.- Returns:
trueif the profile2.wall.enabled flag is set, otherwise returnsfalse.
-
isWallDefaultProfilePage
boolean isWallDefaultProfilePage()
Is the profile2.wall.default flag set in sakai.properties? If not set, defaults tofalse.- Returns:
trueif the profile2.wall.default flag is set, otherwise returnsfalse.
-
isProfileConversionEnabled
boolean isProfileConversionEnabled()
Is the profile2.convert flag set in sakai.properties? If not set, defaults to falseThis 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 falseThis 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 trueDepending 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 totrue.- Returns:
- the status of the profile2.gallery.enabled flag in sakai.properties. Returns
trueby default.
-
isProfilePictureChangeEnabled
boolean isProfilePictureChangeEnabled()
Is the profile2.picture.change.enabled flag set in sakai.properties? If not set, defaults to trueDepending 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.propertiesPossible 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 trueAllows 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
- 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 propertydef- 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 permissionpermission- the permission to check in sitesiteId- 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:
trueif user allowed to create worksites, elsefalse.
-
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
nullif 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:
trueif successful, otherwisefalse.
-
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
nullif 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 falseDepending 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:
trueif the profile2.profile.social.enabled flag is set, otherwise returnsfalse.
-
isInterestsProfileEnabled
boolean isInterestsProfileEnabled()
Is the profile2.profile.interests.enabled flag set in sakai.properties? If not set, defaults to true.- Returns:
trueif the profile2.profile.interests.enabled flag is set, otherwise returnsfalse.
-
isStaffProfileEnabled
boolean isStaffProfileEnabled()
Is the profile2.profile.staff.enabled flag set in sakai.properties? If not set, defaults to true.- Returns:
trueif the profile2.profile.staff.enabled flag is set, otherwise returnsfalse.
-
isStudentProfileEnabled
boolean isStudentProfileEnabled()
Is the profile2.profile.student.enabled flag set in sakai.properties? If not set, defaults to true.- Returns:
trueif the profile2.profile.student.enabled flag is set, otherwise returnsfalse.
-
isNamePronunciationProfileEnabled
boolean isNamePronunciationProfileEnabled()
Is the profile2.profile.name.pronunciation.enabled flag set in sakai.properties? If not set, defaults to true- Returns:
trueif the profile2.profile.name.pronunciation.enabled flag is set, otherwise returnsfalse.
-
isProfileImageImportEnabled
boolean isProfileImageImportEnabled()
Is the profile2.import.images flag set in sakai.properties? If not set, defaults to falseIf 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:
trueif the profile2.menu.enabled flag is set, otherwise returnsfalse.
-
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:
trueif the profile2.connections.enabled flag is set, otherwise returnsfalse.
-
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:
trueif the profile2.search.enabled flag is set, otherwise returnsfalse.
-
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:
trueif the profile2.privacy.enabled flag is set, otherwise returnsfalse.
-
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:
trueif the profile2.preference.enabled flag is set, otherwise returnsfalse.
-
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:
trueif the profile2.myKudos.enabled flag is set, otherwise returnsfalse.
-
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:
trueif the profile2.onlineStatus.enabled flag is set, otherwise returnsfalse.
-
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 userstripped- 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 membershipsiteId- 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 membershipuserId2- userId of user to check membership- Returns:
- true if both users are members of one common site
-
-