Class

PlatformUtilities

PlatformUtilities

Provides cplaceJS utility methods e.g. for finding Pages, Users or Groups by name.

Provided by the platform plugin.

Methods

findGroupByName(groupName) → {Group}

Find a group by its name

Parameters:
Name Type Description
groupName string

name of the group

wrapped group or null if not found

Group
Example
var myGroup = cplace.utils().findGroupByName('myUserGroup');

findUserByLogin(login) → {Person}

Find a user by login

Parameters:
Name Type Description
login string

login of the user

wrapped person or null if not found

Person
Example
var maxMustermann = cplace.utils().findUserByLogin('mustermann@test.tricia');

getAllUsersGroup() → {SystemGroup}

Get the allUsersGroup system group.

Note that system groups differ from normal groups and things like member lookups cannot be performed.

System (pseudo) group of all users on the system.

SystemGroup
Example
var allUsersGroup = cplace.utils().getAllUsersGroup();

getCurrentUser() → {Person}

Get the currently logged in user triggering the script.

If the script wasn't triggered by a user this returns null.

Current user or null if there is no logged in user

Person
Example
var currentUser = cplace.utils().getCurrentUser();

getPagesByName(pageName) → {ArrayLike.<Page>}

Returns all pages for provided pageName.

Parameters:
Name Type Description
pageName string

name of page

  • Iterable of pages
ArrayLike.<Page>
Example
var pages = cplace.utils().getPagesByName('myPageName');

getPagesByName(pageName, optionsopt) → {ArrayLike.<Page>}

Returns all pages for provided pageName and options

Parameters:
Name Type Attributes Description
pageName string

name of page

options JSON <optional>

options to use when searching pages

  • Iterable of pages
ArrayLike.<Page>
Examples
var pages = cplace.utils().getPagesByName('myPageName', {
     space: ['space1uid', 'space2uid'],
     customType: ['type1name', 'type2name']
});
// Options must only be provided if results should be filtered by them.
// In case of only one space or type, no array is needed.
var pages = cplace.utils().getPagesByName('myPageName', {
    space: 'space1uid'
});

getSpaceIdByName(spaceName) → {string}

Returns the Uid of the space found for the provided space name.

Parameters:
Name Type Description
spaceName string

The name of the space to get.

The Uid of the space or null if no spae with such name was found.

string