Package org.sakaiproject.poll.logic
Interface ExternalLogic
-
public interface ExternalLogic
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringconvertFormattedTextToPlaintext(String text)StringgetCurrentLocationId()StringgetCurrentLocationReference()org.sakaiproject.tool.api.ToolSessiongetCurrentToolSession()Needed to invoke helper toolsStringgetCurrentToolURL()StringgetCurrentUserId()StringgetCurrentuserReference()Get the current user reference (/user/admin)TimeZonegetLocalTimeZone()get the correct Timezone for the the current userintgetNumberUsersCanVote()Get the total number of users that have permission for votingList<String>getPermissionKeys()Get a list of the permission keys for the toolList<String>getRoleIdsInRealm(String realmId)Get a list of RoleIds in a the given realmsMap<String,PollRolePerms>getRoles(String locationReference)Get the Roles in a siteStringgetSiteRefFromId(String siteId)Get a site reference "/site/ABCD from its id (ABCD)List<String>getSitesForUser(String userId, String permission)Get the sites users is a member ofStringgetSiteTile(String siteId)StringgetUserEidFromId(String userId)Given a userId, return the associated userEidbooleanisAllowedInLocation(String permission, String locationReference)is the current user allowed to perform the action in the current location?booleanisAllowedInLocation(String permission, String locationReference, String userRefence)is the current user allowed to perform the action in the current location?booleanisMobileBrowser()Is the current user using a mobile browser?booleanisResultsChartEnabled()Are charts enabled on the results page?booleanisRoleAllowedInRealm(String roleId, String realmId, String permission)is the role allowed to perform the function in the given realm?booleanisShowPublicAccess()Are the public access options available to the Instructor?booleanisUserAdmin()Check if the current user has super admin accessbooleanisUserAdmin(String userId)Check if this user has super admin accessvoidnotifyDeletedOption(List<String> userEids, String siteTitle, String pollQuestion)Notify a list of users that an option they voted for in a poll has been deleted.voidpostEvent(String eventId, String reference, boolean modify)Post a new event to the event tracking serviceStringprocessFormattedText(String text, StringBuilder errorMessages)StringprocessFormattedText(String strFromBrowser, StringBuilder errorMessages, boolean checkForEvilTags, boolean replaceWhitespaceTags)voidregisterFunction(String function, boolean userMutable)Register a function with the Sakai Function managervoidregisterStatement(String pollText, boolean newPoll, String pollId)Register a statement with the system LearningResourceStoreServicevoidregisterStatement(String pollText, Vote vote)Register a statement with the system LearningResourceStoreServicevoidsetToolPermissions(Map<String,PollRolePerms> permMap, String locationReference)Set the tool permissions for the given locationbooleanuserIsViewingAsRole()is the user using the "view as ..." feature
-
-
-
Method Detail
-
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
-
isUserAdmin
boolean isUserAdmin()
Check if the current user has super admin access- Parameters:
userId- the internal user id (not username)- Returns:
- true if the user has admin access, false otherwise
-
getCurrentLocationId
String getCurrentLocationId()
- Returns:
- the current location id of the current user
-
getCurrentLocationReference
String getCurrentLocationReference()
- Returns:
- the current location reference of the current user
-
getCurrentToolURL
String getCurrentToolURL()
- Returns:
- the current tool URL of the current user
-
getCurrentUserId
String getCurrentUserId()
- Returns:
- the current sakai user id (not username)
-
getCurrentuserReference
String getCurrentuserReference()
Get the current user reference (/user/admin)- Returns:
-
getUserEidFromId
String getUserEidFromId(String userId)
Given a userId, return the associated userEid- Parameters:
userId- The userId- Returns:
- The userEid
-
isAllowedInLocation
boolean isAllowedInLocation(String permission, String locationReference)
is the current user allowed to perform the action in the current location?- Parameters:
permission-locationReference-
-
isAllowedInLocation
boolean isAllowedInLocation(String permission, String locationReference, String userRefence)
is the current user allowed to perform the action in the current location?- Parameters:
permission-locationReference-the- user
-
getSitesForUser
List<String> getSitesForUser(String userId, String permission)
Get the sites users is a member of- Parameters:
userId-permission-- Returns:
- a list of site references
-
postEvent
void postEvent(String eventId, String reference, boolean modify)
Post a new event to the event tracking service- Parameters:
eventId-reference-does- the event modify state?
-
registerFunction
void registerFunction(String function, boolean userMutable)
Register a function with the Sakai Function manager- Parameters:
function-userMutable-
-
getLocalTimeZone
TimeZone getLocalTimeZone()
get the correct Timezone for the the current user- Returns:
-
getRoleIdsInRealm
List<String> getRoleIdsInRealm(String realmId)
Get a list of RoleIds in a the given realms- Parameters:
RealmId-- Returns:
- a list os frings of the role Ids
-
isRoleAllowedInRealm
boolean isRoleAllowedInRealm(String roleId, String realmId, String permission)
is the role allowed to perform the function in the given realm?- Parameters:
RoleId-realmId-- Returns:
-
getSiteRefFromId
String getSiteRefFromId(String siteId)
Get a site reference "/site/ABCD from its id (ABCD)- Parameters:
siteId-- Returns:
-
setToolPermissions
void setToolPermissions(Map<String,PollRolePerms> permMap, String locationReference) throws SecurityException, IllegalArgumentException
Set the tool permissions for the given location- Parameters:
permMap-locationReference-- Throws:
SecurityExceptionIllegalArgumentException
-
getRoles
Map<String,PollRolePerms> getRoles(String locationReference)
Get the Roles in a site- Parameters:
locationReference-- Returns:
-
userIsViewingAsRole
boolean userIsViewingAsRole()
is the user using the "view as ..." feature- Returns:
-
notifyDeletedOption
void notifyDeletedOption(List<String> userEids, String siteTitle, String pollQuestion)
Notify a list of users that an option they voted for in a poll has been deleted.- Parameters:
userEids- A List of user EID's that identify the users to be notifiedpollQuestion- The text of the poll whose option was deletedsiteTitle- The title of the site that owns the option's poll
-
getCurrentToolSession
org.sakaiproject.tool.api.ToolSession getCurrentToolSession()
Needed to invoke helper tools
-
isResultsChartEnabled
boolean isResultsChartEnabled()
Are charts enabled on the results page? poll.results.chart.enabled=true|false, default false- Returns:
-
isShowPublicAccess
boolean isShowPublicAccess()
Are the public access options available to the Instructor? poll.allow.public.access=true|false, default false- Returns:
-
isMobileBrowser
boolean isMobileBrowser()
Is the current user using a mobile browser?- Returns:
-
getPermissionKeys
List<String> getPermissionKeys()
Get a list of the permission keys for the tool- Returns:
-
registerStatement
void registerStatement(String pollText, Vote vote)
Register a statement with the system LearningResourceStoreService
-
registerStatement
void registerStatement(String pollText, boolean newPoll, String pollId)
Register a statement with the system LearningResourceStoreService
-
getNumberUsersCanVote
int getNumberUsersCanVote()
Get the total number of users that have permission for voting
-
convertFormattedTextToPlaintext
String convertFormattedTextToPlaintext(String text)
- Parameters:
text-- Returns:
-
processFormattedText
String processFormattedText(String text, StringBuilder errorMessages)
- Parameters:
text-errorMessages-- Returns:
-
processFormattedText
String processFormattedText(String strFromBrowser, StringBuilder errorMessages, boolean checkForEvilTags, boolean replaceWhitespaceTags)
- Parameters:
strFromBrowser-errorMessages-checkForEvilTags-replaceWhitespaceTags-- Returns:
-
-