|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface SakaiProxy
An interface for abstracting Sakai specific parts away from the main logic.
| 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. |
org.sakaiproject.tool.api.Tool |
getTool(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. |
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 |
isProfileFieldsEnabled()
Is the profile2.profile.fields.enabled flag set in sakai.properties? If not set, defaults to true. |
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 |
isProfileStatusEnabled()
Is the profile2.profile.status.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 |
|---|
String getCurrentSiteId()
String getCurrentUserId()
org.sakaiproject.user.api.User getCurrentUser()
String getUserEid(String userId)
String getUserIdForEid(String eid)
String getUserDisplayName(String userId)
String getUserFirstName(String userId)
String getUserLastName(String userId)
String getUserEmail(String userId)
boolean checkForUser(String userId)
userId -
boolean checkForUserByEid(String eid)
userId -
boolean isSuperUser()
boolean isAdminUser()
boolean isSuperUserAndProxiedToUser(String userId)
userId - - userId of other user
String getUserType(String userId)
userId -
org.sakaiproject.user.api.User getUserById(String userId)
userId - internal user id
org.sakaiproject.user.api.User getUserQuietly(String 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.
userId -
String getCurrentToolTitle()
List<org.sakaiproject.user.api.User> getUsers(List<String> userUuids)
userUuids - uuids
List<String> getUuids(List<org.sakaiproject.user.api.User> users)
users - Users
org.sakaiproject.api.common.edu.person.SakaiPerson getSakaiPerson(String userId)
userId -
byte[] getSakaiPersonJpegPhoto(String userId)
Returns null if nothing found.
userId -
String getSakaiPersonImageUrl(String userId)
Returns null if nothing found.
userId -
org.sakaiproject.api.common.edu.person.SakaiPerson getSakaiPersonPrototype()
This is not persistable so should only be used for temporary views. Use createSakaiPerson if need persistable object for saving a profile.
userId -
org.sakaiproject.api.common.edu.person.SakaiPerson createSakaiPerson(String userId)
userId -
boolean updateSakaiPerson(org.sakaiproject.api.common.edu.person.SakaiPerson sakaiPerson)
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.
sakaiPerson -
int getMaxProfilePictureSize()
String getProfileGalleryImagePath(String userId,
String imageId)
userId - the ID of the user.imageId - the ID of the image.
String getProfileGalleryThumbnailPath(String userId,
String thumbnailId)
userId - the ID of the user.imageId - the ID of the thumbnail.
String getProfileImageResourcePath(String userId,
int type)
userId - type -
boolean saveFile(String fullResourceId,
String userId,
String fileName,
String mimeType,
byte[] fileData)
fullResourceId - userId - fileName - mimeType - fileData -
MimeTypeByteArray getResource(String resourceId)
resourceId - the full resourceId of the fileboolean removeResource(String resourceId)
resourceId - the ID of the resource to remove.
true if the resource is successfully removed,
false if the remove operation fails.List<org.sakaiproject.user.api.User> searchUsers(String search)
search - search string.
List<org.sakaiproject.user.api.User> searchExternalUsers(String search)
search - search string.
void postEvent(String event,
String reference,
boolean modify)
event - name of eventreference - referencemodify - true if something changed, false if just access
void sendEmail(String userId,
String subject,
String message)
userId - userId to send the message tosubject - subject of messagemessage - complete with newlines and any links.
void sendEmail(List<String> userIds,
String emailTemplateKey,
Map<String,String> replacementValues)
users - list of userIds to send to - already cleaned up for their email preferencesemailTemplateKey - the email template
void sendEmail(String userId,
String emailTemplateKey,
Map<String,String> replacementValues)
user - userId to send to - already cleaned up for their email preferencesemailTemplateKey - the email templateString getServiceName()
String getPortalUrl()
String getServerUrl()
String getServerName()
String getUserHomeUrl()
String getPortalPath()
boolean isUsingNormalPortal()
String getFullPortalUrl()
void updateEmailForUser(String userId,
String email)
userId - uuid of the useremail -
void updateNameForUser(String userId,
String firstName,
String lastName)
userId - uuid of the useremail -
String getDirectUrlToUserProfile(String userId,
String extraParams)
userId - uuid of the userextraParams - any extra params to add to the query string
boolean isAccountUpdateAllowed(String userId)
userId -
boolean isBusinessProfileEnabled()
false.
true if the profile2.profile.business.enabled flag
is set, otherwise returns false.boolean isWallEnabledGlobally()
false.
true if the profile2.wall.enabled flag is set,
otherwise returns false.boolean isWallDefaultProfilePage()
false.
true if the profile2.wall.default flag is set,
otherwise returns false.boolean isProfileConversionEnabled()
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.
boolean isProfileImportEnabled()
This will import profiles from a csv file specified by the profile2.import.csv property
String getProfileImportCsvPath()
boolean isTwitterIntegrationEnabledGlobally()
Depending on this setting, the UI will allow a user to input their Twitter settings and their status updates will be sent to Twitter.
String getTwitterSource()
boolean isProfileGalleryEnabledGlobally()
true.
true by default.boolean isProfilePictureChangeEnabled()
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.
int getProfilePictureType()
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
List<String> getAcademicEntityConfigurationSet()
List<String> getMinimalEntityConfigurationSet()
String ensureUuid(String userId)
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.
userId -
boolean currentUserMatchesRequest(String userUuid)
userUuid - uuid to check against current user
boolean isPrivacyChangeAllowedGlobally()
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
HashMap<String,Object> getOverriddenPrivacySettings()
List<String> getInvisibleUsers()
boolean isConnectionAllowedBetweenUserTypes(String requestingUserType,
String targetUserType)
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.
requestingUserType - targetUserType -
boolean toggleProfileLocked(String userId,
boolean locked)
userId - locked -
boolean isOfficialImageEnabledGlobally()
boolean isUsingOfficialImageButAlternateSelectionEnabled()
String getOfficialImageSource()
String getOfficialImageAttribute()
String createUuid()
boolean isUserActive(String userUuid)
userUuid - user to check
List<String> getActiveUsers(List<String> userUuids)
userUuids - List of users to check
Long getLastEventTimeForUser(String userUuid)
userUuid - user to check
Map<String,Long> getLastEventTimeForUsers(List<String> userUuids)
userUuids - users to check
String getServerConfigurationParameter(String key,
String def)
key - key of propertydef - default value
boolean isUserMyWorkspace(String siteId)
siteId - id of site
boolean isUserAllowedInSite(String userId,
String permission,
String siteId)
userId - userId of user to check permissionpermission - the permission to check in sitesiteId - site id
boolean checkForSite(String siteId)
siteId -
int getMaxSearchResults()
int getMaxSearchResultsPerPage()
boolean isGravatarImageEnabledGlobally()
boolean isUserAllowedAddSite(String userUuid)
true if user allowed to create worksites, else false.
org.sakaiproject.site.api.Site addSite(String id,
String type)
id - the id of the site.type - the type of the site e.g. project.
null if there is a problem creating the site.boolean saveSite(org.sakaiproject.site.api.Site site)
site - a reference to the site to save.
true if successful, otherwise false.org.sakaiproject.site.api.Site getSite(String siteId)
siteId -
List<org.sakaiproject.site.api.Site> getUserSites()
org.sakaiproject.tool.api.Tool getTool(String id)
id - the id of the tool required.
null if a
reference cannot be obtained.List<String> getToolsRequired(String category)
category - the type of site e.g. 'project'
boolean isGoogleIntegrationEnabledGlobally()
Depending on this setting, the UI will allow a user to add their Google account. For institutions to use this there additional setup required.
boolean isLoggedIn()
boolean isProfileFieldsEnabled()
This setting controls the display of the profile fields.
boolean isProfileStatusEnabled()
This setting controls the display of the profile status section.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||