Interface SakaiProxy
-
public interface SakaiProxyAn interface to abstract all Sakai related API calls in a central method that can be injected into our app.- Author:
- Bryan Holladay (holladay@longsight.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SecurityAdvisoraddSiteUpdateSecurityAdvisor()Adds a security advisor to allow site.updatebooleanallowAccessAdminsSetBecomeUserPerm()Returns a sakai.property: delegatedaccess.allow.accessadmin.set.allowBecomeUser (default true) This property determines whether an Access Admin is able to set the advanced option permission "allowBecomeUser".voidcopyNewRole(String siteRef, String copyRealm, String copyRole, String newRole)Copy one role to another in anAuthzGroupList<Site>getAllSites()returns all site's in SakaiList<Site>getAllSitesByPages(Map<String,String> propsMap, int page, int pageMax, boolean orderByModifiedDate)returns all sites in Sakai, but uses a paging mechanismSet<Tool>getAllTools()returns all available tools in Sakai Map: ToolId -> Tool NameAuthzGroupgetAuthzGroup(String siteRef)Remove this role from the authz group and update the group.PlacementgetCurrentPlacement()get current placementSessiongetCurrentSession()returns the user's current sessionStringgetCurrentUserId()Get current user idMap<String,List<String>>getDelegatedAccessRealmOptions()Returns a list of realm/role options for the shopping period role first checks the sakai.property: delegatedaccess.realmoptions.delegatedaccess if not found, defaults to: all site realm templates that start with "!booleangetDisableShoppingTreeView()returns a sakai.property for delegatedaccess.disable.shopping.tree.viewbooleangetDisableUserTreeView()returns the setting for delegatedaccess.disable.user.tree.viewString[]getHideRolesForInstructorViewAccess()returns a list of hidden roles that an instructor shouldn't know have access to their site delegatedaccess.siteaccess.instructorViewable.hiddenRolesStringgetHierarchySearchLabel(String hierarchyLevel)returns a label for a hierarchy if it exists: delegatedaccess.search.hierarchyLabel.String[]getHomeTools()returns sakai.properties setting of home tool ids delegatedaccess.hometoolsList<User>getInstructorsForSite(String siteId)returns a list of users who have site.upd permission for this siteStringgetProviderId(String siteRef)returns the provider id for a realmStringgetRootName()will return Sakai's name for the root of the hierarchy.String[]getServerConfigurationStrings(String property)Returns a list of Strings for the sakai.propertyMap<String,List<String>>getShoppingRealmOptions()Returns a list of realm/role options for the shopping period role first checks the sakai.property: delegatedaccess.realmoptions.shopping if not found, defaults to: all site realm templates that start with "!booleangetShoppingUIEnabled()returns a sakai.property for delegatedaccess.shopping.UI.enabledSitegetSiteById(String siteRef)Returns the site for that IdSitegetSiteByRef(String siteRef)Returns the site for the site refList<Site>getSites(SiteService.SelectionType type, String search, Map<String,String> propsMap)Returns a list of sites based on the attributes sent inStringgetSkinRepoProperty()Wrapper for ServerConfigurationService.getString("skin.repo")String[]getSubAdminOrderedRealmRoles()returns a list of "realm:role;realm:role;" from highest to lowest level of access.booleangetSyncMyworkspaceTool()returns a sakai.property value for the setting: delegatedaccess.sync.myworkspacetool true by defaultStringgetTermField()returns the systems term field based on a sakai.property (delegatedaccess.termfield) default is term_eidList<String[]>getTerms()Returns a map (id, title) of terms either by the course management api or by the unique set of site propeties if you unset useCourseManagementApiForTermsToolgetTool(String toolId)returns the tool for the given tool idStringgetToolSkinCSS(String skinRepo)Gets the tool skin CSS first by checking the tool, otherwise by using the default property.booleangetToolsListUIEnabled()returns a sakai.property for delegatedaccess.toolslist.UI.enabledUsergetUser(String id)returns a user for passed in userIdUsergetUserByEid(String eid)returns user by eidSet<String>getUserMembershipForCurrentUser()returns a list of site references that the current user has access tobooleanisActiveSiteFlagEnabled()This requires an external quartz job that determines whether a site is active or not.booleanisProviderIdLookupEnabled()if this is set to true, then a "provider id lookup" column will be added to DA search results delegatedaccess.enableProviderIdLookupbooleanisSearchHideTerm()If this is set to true, then the term dropdown option in the search pages will be hidden delegatedaccess.search.hideTermbooleanisShoppingPeriodInstructorEditable()returns true if delegatedaccess.shopping.instructorEditable is set to true, otherwise, falsebooleanisShoppingTool()returns true if this is the shopping period toolbooleanisSuperUser()Is the current user a superUser?booleanisUserInstructor(String userId, String siteId)returns true only if the user is a member of the site and has site.upd permissionbooleanisUserMember(String userId, String siteRef)returns true if the user is a member of the siteMap<String,String>isUserMember(String userId, Collection<String> siteRefs)returns a map of site ref -> role.voidpopSecurityAdvisor(SecurityAdvisor advisor)pops the site.update security advisorvoidpostEvent(String event, String reference, boolean modify)Post an event to SakaivoidrefreshCurrentUserAuthz()call authzGroupService.refreshUser for current uservoidremoveRoleFromAuthzGroup(AuthzGroup group, Role role)Delete anAuthzGroupin SakaivoidsaveSite(Site site)Save a Sakai site via the SiteService.List<User>searchUsers(String search)user's Sakai userDirectoryService to search for usersvoidsendEmail(String subject, String body)Sends an emailvoidsetSessionUserId(String userId)Sets the current session userIdStringsiteReference(String context)get site reference from site idbooleanuseCourseManagementApiForTerms()default is true if this is true, then the term options will be loaded from the CourseManagement API, otherwise, a distinct query will be ran against site properties based on the term field delegatedaccess.term.useCourseManagmentApi
-
-
-
Method Detail
-
getCurrentUserId
String getCurrentUserId()
Get current user id- Returns:
-
isSuperUser
boolean isSuperUser()
Is the current user a superUser? (anyone in admin realm)- Returns:
-
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
-
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:
-
getCurrentSession
Session getCurrentSession()
returns the user's current session- Returns:
-
getAllSitesByPages
List<Site> getAllSitesByPages(Map<String,String> propsMap, int page, int pageMax, boolean orderByModifiedDate)
returns all sites in Sakai, but uses a paging mechanism- Parameters:
propsMap- can be null or send over props to filter sites onpage- Page to start from (1 based)pageMax- maximum number of sites per pageorderByModifiedDate-- Returns:
-
searchUsers
List<User> searchUsers(String search)
user's Sakai userDirectoryService to search for users- Parameters:
search-first-last-- Returns:
-
getSiteByRef
Site getSiteByRef(String siteRef)
Returns the site for the site ref- Parameters:
siteRef-- Returns:
-
getSiteById
Site getSiteById(String siteRef)
Returns the site for that Id- Parameters:
siteRef-- Returns:
-
saveSite
void saveSite(Site site)
Save a Sakai site via the SiteService.- Parameters:
site-
-
getRootName
String getRootName()
will return Sakai's name for the root of the hierarchy. Looks first for sakai.property: HIERARCHY_ROOT_TITLE_PROPERTY, then ui.service, then finally just defaults to the string "Sakai".- Returns:
-
getServerConfigurationStrings
String[] getServerConfigurationStrings(String property)
Returns a list of Strings for the sakai.property- Parameters:
property-- Returns:
-
getShoppingRealmOptions
Map<String,List<String>> getShoppingRealmOptions()
Returns a list of realm/role options for the shopping period role first checks the sakai.property: delegatedaccess.realmoptions.shopping if not found, defaults to: all site realm templates that start with "!site."- Returns:
-
getDelegatedAccessRealmOptions
Map<String,List<String>> getDelegatedAccessRealmOptions()
Returns a list of realm/role options for the shopping period role first checks the sakai.property: delegatedaccess.realmoptions.delegatedaccess if not found, defaults to: all site realm templates that start with "!site."- Returns:
-
refreshCurrentUserAuthz
void refreshCurrentUserAuthz()
call authzGroupService.refreshUser for current user
-
getAllTools
Set<Tool> getAllTools()
returns all available tools in Sakai Map: ToolId -> Tool Name- Returns:
-
getUserMembershipForCurrentUser
Set<String> getUserMembershipForCurrentUser()
returns a list of site references that the current user has access to- Returns:
-
getAuthzGroup
AuthzGroup getAuthzGroup(String siteRef)
Remove this role from the authz group and update the group.- Parameters:
siteRef-role-- Returns:
-
removeRoleFromAuthzGroup
void removeRoleFromAuthzGroup(AuthzGroup group, Role role)
Delete anAuthzGroupin Sakai- Parameters:
id-
-
copyNewRole
void copyNewRole(String siteRef, String copyRealm, String copyRole, String newRole)
Copy one role to another in anAuthzGroup- Parameters:
siteRef-copyRealm-copyRole-newRole-
-
addSiteUpdateSecurityAdvisor
SecurityAdvisor addSiteUpdateSecurityAdvisor()
Adds a security advisor to allow site.update- Returns:
-
popSecurityAdvisor
void popSecurityAdvisor(SecurityAdvisor advisor)
pops the site.update security advisor- Parameters:
advisor-
-
getSites
List<Site> getSites(SiteService.SelectionType type, String search, Map<String,String> propsMap)
Returns a list of sites based on the attributes sent in- Parameters:
type-search-propsMap-- Returns:
-
isShoppingTool
boolean isShoppingTool()
returns true if this is the shopping period tool- Returns:
-
getTermField
String getTermField()
returns the systems term field based on a sakai.property (delegatedaccess.termfield) default is term_eid- Returns:
-
getHomeTools
String[] getHomeTools()
returns sakai.properties setting of home tool ids delegatedaccess.hometools- Returns:
-
useCourseManagementApiForTerms
boolean useCourseManagementApiForTerms()
default is true if this is true, then the term options will be loaded from the CourseManagement API, otherwise, a distinct query will be ran against site properties based on the term field delegatedaccess.term.useCourseManagmentApi- Returns:
-
getTerms
List<String[]> getTerms()
Returns a map (id, title) of terms either by the course management api or by the unique set of site propeties if you unset useCourseManagementApiForTerms- Returns:
-
getDisableUserTreeView
boolean getDisableUserTreeView()
returns the setting for delegatedaccess.disable.user.tree.view- Returns:
-
getDisableShoppingTreeView
boolean getDisableShoppingTreeView()
returns a sakai.property for delegatedaccess.disable.shopping.tree.view- Returns:
-
getToolsListUIEnabled
boolean getToolsListUIEnabled()
returns a sakai.property for delegatedaccess.toolslist.UI.enabled- Returns:
-
getShoppingUIEnabled
boolean getShoppingUIEnabled()
returns a sakai.property for delegatedaccess.shopping.UI.enabled- Returns:
-
isUserInstructor
boolean isUserInstructor(String userId, String siteId)
returns true only if the user is a member of the site and has site.upd permission- Parameters:
userId-siteId-- Returns:
-
isShoppingPeriodInstructorEditable
boolean isShoppingPeriodInstructorEditable()
returns true if delegatedaccess.shopping.instructorEditable is set to true, otherwise, false- Returns:
-
isUserMember
boolean isUserMember(String userId, String siteRef)
returns true if the user is a member of the site- Parameters:
userId-siteRef-- Returns:
-
getInstructorsForSite
List<User> getInstructorsForSite(String siteId)
returns a list of users who have site.upd permission for this site- Parameters:
siteId-- Returns:
-
getSyncMyworkspaceTool
boolean getSyncMyworkspaceTool()
returns a sakai.property value for the setting: delegatedaccess.sync.myworkspacetool true by default- Returns:
-
getTool
Tool getTool(String toolId)
returns the tool for the given tool id- Parameters:
toolId-- Returns:
-
getHideRolesForInstructorViewAccess
String[] getHideRolesForInstructorViewAccess()
returns a list of hidden roles that an instructor shouldn't know have access to their site delegatedaccess.siteaccess.instructorViewable.hiddenRoles- Returns:
-
isUserMember
Map<String,String> isUserMember(String userId, Collection<String> siteRefs)
returns a map of site ref -> role. If role is null, then they are not a member- Parameters:
userId-siteRefs-- Returns:
-
getSubAdminOrderedRealmRoles
String[] getSubAdminOrderedRealmRoles()
returns a list of "realm:role;realm:role;" from highest to lowest level of access. For instance, if you wanted to order the importance of roles of sakai's default permissions, it would look like: 1-> "!site.template.course :Instructor;!site.template:maintain;" 2-> "!site.template.course :TA;" 3-> "!site.template.course :Student;!site.template:access;" This will only allow subadmin to assign permissions at their level and below. Any realm/role that isn't in that list will be considered the last level on the bottom.- Returns:
-
isActiveSiteFlagEnabled
boolean isActiveSiteFlagEnabled()
This requires an external quartz job that determines whether a site is active or not. If ths site is active, this job will set "activesite" permission to the site node DAC-40 Highlight Inactive Courses in site search requires the job "InactiveCoursesJob" attached in the jira- Returns:
-
setSessionUserId
void setSessionUserId(String userId)
Sets the current session userId- Parameters:
userId-
-
allowAccessAdminsSetBecomeUserPerm
boolean allowAccessAdminsSetBecomeUserPerm()
Returns a sakai.property: delegatedaccess.allow.accessadmin.set.allowBecomeUser (default true) This property determines whether an Access Admin is able to set the advanced option permission "allowBecomeUser".- Returns:
-
siteReference
String siteReference(String context)
get site reference from site id- Parameters:
context-- Returns:
-
getCurrentPlacement
Placement getCurrentPlacement()
get current placement- Returns:
-
isProviderIdLookupEnabled
boolean isProviderIdLookupEnabled()
if this is set to true, then a "provider id lookup" column will be added to DA search results delegatedaccess.enableProviderIdLookup- Returns:
-
getProviderId
String getProviderId(String siteRef)
returns the provider id for a realm- Parameters:
siteRef-- Returns:
-
getHierarchySearchLabel
String getHierarchySearchLabel(String hierarchyLevel)
returns a label for a hierarchy if it exists: delegatedaccess.search.hierarchyLabel.{hierarchyLevel}- Parameters:
hierarchyLevel-- Returns:
-
isSearchHideTerm
boolean isSearchHideTerm()
If this is set to true, then the term dropdown option in the search pages will be hidden delegatedaccess.search.hideTerm- Returns:
-
-