Interface ExternalLogic
-
public interface ExternalLogicThis is the interface for logic which is external to our app logic
-
-
Field Summary
Fields Modifier and Type Field Description static StringEVENT_EMAIL_SENDstatic StringNO_LOCATIONstatic StringPERM_ADMINstatic StringPERM_SEND
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaddToArchive(ConfigEntry config, String channelRef, String sender, String subject, String body, List<org.sakaiproject.email.api.Attachment> attachments)Append email to Email ArchiveStringgetCurrentLocationId()org.sakaiproject.site.api.SitegetCurrentSite()Get the current site's detailsStringgetCurrentSiteTitle()StringgetCurrentToolURL()org.sakaiproject.user.api.UsergetCurrentUser()Get details for the current userStringgetCurrentUserId()List<String>getPermissionKeys()Get a list of the permission keys for the toolStringgetSiteID()Get the site id for the current siteStringgetSiteRealmID()Get the realm id for the current siteStringgetSiteType()Get the type of the current siteorg.sakaiproject.user.api.UsergetUser(String userId)Get details for a userStringgetUserDisplayName(String userId)Get the display name for a user by their unique idbooleanisEmailArchiveAddedToSite()Check if the email archive tool is added to the current sitebooleanisUserAdmin(String userId)Check if this user has super admin accessbooleanisUserAllowedInLocation(String userId, String permission, String locationId)Check if a user has a specified permission within a context, primarily a convenience method and passthroughbooleanisUserSiteAdmin(String userId, String locationId)Check if this user has site update accessList<String>sendEmail(ConfigEntry config, String fromEmail, String fromName, Map<String,String> to, String subject, String content, List<org.sakaiproject.email.api.Attachment> attachments)Send email to a list of users.
-
-
-
Field Detail
-
NO_LOCATION
static final String NO_LOCATION
- See Also:
- Constant Field Values
-
EVENT_EMAIL_SEND
static final String EVENT_EMAIL_SEND
- See Also:
- Constant Field Values
-
PERM_ADMIN
static final String PERM_ADMIN
- See Also:
- Constant Field Values
-
PERM_SEND
static final String PERM_SEND
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCurrentUserId
String getCurrentUserId()
- Returns:
- the current sakai user id (not username)
-
getCurrentUser
org.sakaiproject.user.api.User getCurrentUser()
Get details for the current user- Returns:
-
getUserDisplayName
String getUserDisplayName(String userId)
Get the display name for a user by their unique id- Parameters:
userId- the current sakai user id (not username)- Returns:
- display name (probably firstname lastname) or "----------" (10 hyphens) if none found
-
getUser
org.sakaiproject.user.api.User getUser(String userId)
Get details for a user- Parameters:
userId-- Returns:
-
getCurrentSiteTitle
String getCurrentSiteTitle()
- Parameters:
locationId- a unique id which represents the current location of the user (entity reference)- Returns:
- the title for the context or "--------" (8 hyphens) if none found
-
getCurrentSite
org.sakaiproject.site.api.Site getCurrentSite()
Get the current site's details- Returns:
-
getSiteID
String getSiteID()
Get the site id for the current site- Returns:
-
getSiteRealmID
String getSiteRealmID()
Get the realm id for the current site- Returns:
-
getSiteType
String getSiteType()
Get the type of the current site- Returns:
-
isUserSiteAdmin
boolean isUserSiteAdmin(String userId, String locationId)
Check if this user has site update access- Parameters:
userId- the internal user id (not username)locationId- a unique id which represents the current location of the user (entity reference)- Returns:
- true if the user has site update access, false otherwise
-
isUserAdmin
boolean isUserAdmin(String userId)
Check if this user has super admin access- Parameters:
userId- the internal user id (not username)- Returns:
- true if the user has admin access, false otherwise
-
isUserAllowedInLocation
boolean isUserAllowedInLocation(String userId, String permission, String locationId)
Check if a user has a specified permission within a context, primarily a convenience method and passthrough- Parameters:
userId- the internal user id (not username)permission- a permission string constantlocationId- a unique id which represents the current location of the user (entity reference)- Returns:
- true if allowed, false otherwise
-
isEmailArchiveAddedToSite
boolean isEmailArchiveAddedToSite()
Check if the email archive tool is added to the current site- Returns:
- true if email archive tool exists, false otherwise
-
sendEmail
List<String> sendEmail(ConfigEntry config, String fromEmail, String fromName, Map<String,String> to, String subject, String content, List<org.sakaiproject.email.api.Attachment> attachments) throws MailsenderException, AttachmentException
Send email to a list of users. After validation, if there are any valid email addresses available, the email is sent to those recipients and the invalid recipients are returned to the caller.- Parameters:
config-fromEmail-fromName-to- Map of email addresssubject-content-attachments-- Returns:
- List of email addresses that were found to be invalid.
- Throws:
AttachmentExceptionMailsenderException
-
addToArchive
boolean addToArchive(ConfigEntry config, String channelRef, String sender, String subject, String body, List<org.sakaiproject.email.api.Attachment> attachments)
Append email to Email Archive- Parameters:
config- The config used by the user, can benull.channelRef- The Email Archive channel reference to add the email to.sender- The email sender (eg John Smith <john.smith@example.com>)subject- The Subject of the email.body- The body of the email message.attachments- A list of attachments, can benull.- Returns:
- true if success
-
getCurrentLocationId
String getCurrentLocationId()
- Returns:
- the current location id of the current user
-
getCurrentToolURL
String getCurrentToolURL()
- Returns:
- the current tool URL of the current user
-
-