Interface SakaiProxy


  • public interface SakaiProxy
    An 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 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 event
        reference - reference
        modify - 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:
      • getAllSites

        List<Site> getAllSites()
        returns all site's in Sakai
        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 on
        page - Page to start from (1 based)
        pageMax - maximum number of sites per page
        orderByModifiedDate -
        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 an AuthzGroup in Sakai
        Parameters:
        id -
      • copyNewRole

        void copyNewRole​(String siteRef,
                         String copyRealm,
                         String copyRole,
                         String newRole)
        Copy one role to another in an AuthzGroup
        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 -
      • 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:
      • sendEmail

        void sendEmail​(String subject,
                       String body)
        Sends an email
        Parameters:
        subject -
        body -
      • 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:
      • getUser

        User getUser​(String id)
        returns a user for passed in userId
        Parameters:
        id -
        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:
      • getUserByEid

        User getUserByEid​(String eid)
        returns user by eid
        Parameters:
        eid -
        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: