loadFullProfile: function(poolid, callback) {
Loads the full content profile containing: - poolid.infinity.json -> Fetches all general data for a content item (description, tags, title,...) - members.json -> Fetches all viewers, editors and managers for a content item - versions.json -> Fetches all versions for a content item - activityfeed.json -> Fetches all activity for a content item and returns it in a callback function
param {String} Pooled content id for the item to load the content profile for
param {Function} callback Function that executes when all data thas been gathered, passes through the unparsed results.
setFilePermissions : function(filesArray, callback, groupID) {
Set the permissions for an array of uploaded files or links
param {String} permissionValue either 'public', 'everyone', 'group' or 'private'
param {Array} filesArray Array of files containing the 'hashpath' property per file. This hashpath is the resourceID of the file
param {Function} callback Function to call when the permissions have been saved or failed to save. The callback function is provided with a Boolean. True = permissions successfully set, False = permissions not set (error)
setFilePermissionsAsParent: function(filesArray, parentSavePath, callback) {
Sets the permissions of an Array of files to be the same as their parent Order of execution: - Load parent permissions - Set parent permission parameter on content nodes - Set ACLs on content node - Callback if present
param {Array} filesArray Array of files (PoolIDs)
param {String} parentSavePath savePath of the parent
param {Function} callback Executed on completion of the function
var setDataOnContent = function(filesToSetPermissions, batchRequests) {
Set parent permission parameter on content nodes
param {Array} filesToSetPermissions Array of files to set ACLs on
param {Array} batchRequests Array of requests to set permission parameter on content nodes
var getParentPermissions = function() {
Get the permissons set on the parent
setACLsOnPath: function(_path, _permission, me, callback) {
Sets ACLs on a specified path and executes a callback if specified.
param {String} _path The path on which the ACLs need to be set or an array of paths on which to set ACLs
param {String} _permission 'anonymous', 'everyone', 'contacts' or 'private' determining what ACLs need to be set This should be an array of equal length of _path is an array
param {String} me Userid of the currently logged in user
param {Function} callback Function to execute when permissions have been set or failed to be set
checkPermissions: function(content, meObj, permission, directOnly) {
Check whether a user has specific access to a piece of content, either by being a direct or indirect (through group membership) manager/editor/viewer
param {Object} content content profile data as defined in loadContentProfile()
param {Object} meObj me object of the user you are checking permissions for
param {String} permission specifies the type of access to check (manager, editor or viewer)
param {Object} directOnly specifies whether or not the relationship needs to be direct
isUserAManager: function(content, meObj, directOnly) {
Check whether a user can manage a piece of content, either by being a direct or indirect (through group membership) manager
param {Object} content content profile data as defined in loadContentProfile()
param {Object} meObj me object of the user you are checking manager permissions for
param {Object} directOnly specifies whether or not the manager relationship needs to be direct
isUserAnEditor: function(content, meObj, directOnly) {
Check whether a user can edit a piece of content, either by being a direct or indirect (through group membership) manager
param {Object} content content profile data as defined in loadContentProfile()
param {Object} meObj me object of the user you are checking manager permissions for
param {Object} directOnly specifies whether or not the manager relationship needs to be direct
isUserAViewer: function(content, meObj, directOnly) {
Check whether a user is a viewer of a piece of content, either by being a direct or indirect (through group membership) viewer
param {Object} content content profile data as defined in loadContentProfile()
param {Object} meObj me object of the user you are checking manager permissions for
param {Object} directOnly specifies whether or not the manager relationship needs to be direct
isContentInLibrary: function(content, userid) {
Check whether a given content item lives in a specific content library (either a personal library or a group library
param {Object} content content profile data as defined in loadContentProfile()
param {Object} userid authorizable id for which we're checking presence in the library
canCurrentUserShareContent: function(content) {
Checks if a user is allowed to share the specified content
param {Object} content The content profile data as defined in loadContentProfile()
addToLibrary: function(contentId, userId, role, callBack) {
Shares content with a user and sets permissions for the user. This function can handle single user/content or multiple user/content items in an array
param {String|Array} contentId Unique pool id or Array of IDs of the content being added to the library
param {String} userId Authorizable id of the library to add this content in
param {String} role The role the user should have with the content that's being shared, defaults to viewer
param {Object} callBack Function to call once the content has been added to the library
removeUser: function(role, contentId, userId, callback) {
Removes multiple users from the specified role for multiple content items
param role content profile data as defined in loadContentProfile()
param {String} role The role to remove user(s) from
param {String/Array} contentId The content to remove the user from
param {String/Array} userId The user to remove
param {Function} callback Callback function
checkAutosave: function(newPage, pagePath, callback) {
Checks for autosaved documents for a sakai doc and returns that data
param {Boolean} Indicating if the sakai doc is a new page that can't have a autosaved page yet
param {String} Path to the sakai document in the system
param {Function} Callback function to execute on finish
getPreviewUrl : function(url) {
Returns a preview URL for known services, empty string otherwise
param url The url of the content in an external service that you'd like a preview of
getMimeTypeData: function(mimetype) {
Returns an object with data for the provided mimetype
param mimetype standard mimetype string (i.e. 'image/png', 'application/pdf', etc.)
return if we have a match for the given mimetype, an Object with the following params will be returned: - cssClass: css class to assign a small (~16px) image as the background image for an element - URL: path to an image (~128px) that represents this content type - description: internationalizable bundle key for a short description for this content type (i.e. 'PDF document') If there is no match, a general 'Other document' object is returned
getNewList : function(library) {
getNewList: get a new list of content based on newly uploaded or saved content
param {String} library The library to get the data for
return {Object} the passed-in data combined with the newly shared/uploaded content
prepareContentForRender : function(results, meData, callback, threeDotsWidths) {
Function to process search results for content
param {Object} results Search results to process
param {Object} meData User object for the user
param {Function} callback Callback function executed at the end of the operation
param {Object} threeDotsWidths Optional object to specify widths for applyThreeDots in the list view: titleWidth {Integer} limit the title to this width in list view descriptionWidth {Integer} limit the description to this width in list view displayNameWidth {Integer} limit the owner display name to this width in list view
returns void
Collections: {
Set of API function around collection creation and management
COLLECTION_GROUP_PREFIX: 'c-',
Prefix that will be prepended to all pseudoGroups created for collections
createCollection: function(title, description, permissions, tags, contentToAdd, usersToAdd, callback) {
Create a new content collection. This includes the creation of a pooled content item and a pseudoGroup used to share content with. The auth-all feed for that pseudoGroup is then used to retrieve the content of the collection
param {Object} title Title of the collection
param {Object} description Description of the collection
param {Object} permissions Permission to be set on the collection. Possible values are 'public', 'everyone' and 'private'
param {Object} tags Tags to be set on the collection
param {Object} contentToAdd Array of pooled content items that need to be added to the collection
param {Object} usersToAdd Array of {'id': authorizableId, 'role': 'member/manager'} objects that determines who can see and who can edit the collections
param {Object} callback Function to be called after the collections has been created. This will pass in a success parameter and
addToCollection: function(collectionId, poolIds, callback) {
Add a number of content items to an existing collection
param {Object} collectionId Pooled content id that represents the collection
param {Object} poolIds Array of pooled content ids to be added to the collection
param {Object} callback Function to be called when the content has been added to the collection
removeFromCollection: function(collectionId, poolIds, callback) {
Remove a number of content items from an existing collection
param {Object} collectionId Pooled content id that represents the collection
param {Object} poolIds Array of pooled content ids to be removed from the collection
param {Object} callback Function to be called when the content has been removed from the collection
setCollectionPermissions: function(collectionId, permission, callback) {
Make a collection either public, private or only visible to the people it's shared with
param {Object} collectionId Pooled content id that represents the collection
param {Object} permission Permission to be set on the collection. Possible values are 'public', 'everyone' and 'private'
param {Object} callback Function to be called when the new permissions have been set on the collection
shareCollection: function(collectionIds, authorizables, role, callback) {
Share a collection with a list of users/groups
param {Object} collectionIds Pooled content id(s) for the collection that's shared
param {Object} authorizables Array of authorizable ids to share the collection with
param {String} role The role the user should have with the collection that's being shared, defaults to member
param {Object} callback Function to call when the collection has been shared
getCollectionRolePseudoGroup: function(role) {
Returns the pseudo group the role belongs to
param {String} role The role to check for
currentUserHasCollectionRole: function(collectionid, role) {
Check whether the current user can manage a given collection
param {Object} collectionid Pseudogroup id of the collection
param {String} role The role to check for
canCurrentUserManageCollection: function(collectionid) {
Check whether the current user can manage a given collection
param {Object} collectionid Pseudogroup id of the collection
canCurrentUserEditCollection: function(collectionid) {
Check whether the current user can edit a given collection
param {Object} collectionid Pseudogroup id of the collection
getMyCollectionsCount: function() {
Retrieve the number of collections that are in my library
getMyCollections: function(page, items, callback, cache) {
Get a list of the current user's collections in his library
param {Object} page The page number to retrieve
param {Object} items Number of items on each page
param {Object} callback Function to call when the collections have been retrieved
param {Boolean} cache Sets cache option for the ajax request
getCollectionContentCount: function(collection) {
Get the number of items that are part of a specific collection
param {Object} collection This can either be the pooled id of a collection object or the full collection pooled content object
isCollection: function(identifier) {
Check whether a given object represents a collection
param {Object} identifier This can be a group id, a content object or a group object
isCollectionInMyLibrary: function(collection) {
Check whether a collection is part of my library or not
param {Object} collection This can be the pooled content id of the collection or the pooled content object of the collection
getCollectionGroupId: function(collection) {
Get the group ID of the pseudoGroup that's associated to a collection
param {Object} collection This can be the pooled content id of the collection or the pooled content object of the collection
getCollectionPoolId: function(collectionGroup) {
Get the pool id of a collection pseudoGroup
param {Object} collectionGroup This can be the collection group id or the collection group object