Interface ExternalLogic


  • public interface ExternalLogic
    This is the interface for logic which is external to our app logic
    • 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 constant
        locationId - 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
      • 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 be null.
        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 be null.
        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
      • getPermissionKeys

        List<String> getPermissionKeys()
        Get a list of the permission keys for the tool
        Returns:
        List of the permission keys