API Docs for: 1.0.0
Show:

CWTPortalUtil Class

Class to assist with portal management

Constructor

CWTPortalUtil

(
  • sp_portal
)

Parameters:

  • sp_portal GlideRecord | String

    Reference to the Service Portal or the SysID of the portal to use.

Methods

copy

(
  • source
  • [values]
)
GlideRecord

Copy a portal.

Additionally copies the Theme and Homepage as they tend to need to be unique for the new Portal.

Parameters:

  • source GlideRecord
  • [values] Object optional

    Optional object mapping properties to new values to use on the copy.

Returns:

GlideRecord:

New GlideRecord pointing to the newly created copy.

copyRecord

(
  • source
  • [keysAppend]
  • [keysIgnore]
)
GlideRecord

Creates a "surface" level copy of the passed object.

Any child relationships from the source record are not copied, their references are merely repeated in the created copy.

Parameters:

  • source GlideRecord
  • [keysAppend] Array optional

    Optional array of property names to which " - Copy" should be added. The keys "Title" (records), "Name" (records), and "ID" (widgets) are always considered append keys. This applies to "u_title", "u_name", and "u_id" as well.

  • [keysIgnore] Array optional

    Optional array of property names to ignore when copying. sys_id is always automatically ignored for this process.

Returns:

GlideRecord:

New GlideRecord pointing to the newly created copy.

hasAccess

(
  • [sys_id]
)
Boolean

Parameters:

  • [sys_id] String optional

    Optional SysID of the user to check for access to the current portal. Defaults to the current user.

Returns:

Boolean:

True if the user is directly listed as a content creator, false otherwise.

hasAccessTo

(
  • portal_id
  • [admin_roles]
  • [user_id]
)
Boolean

Parameters:

  • portal_id GlideRecord | String

    Indicates the Portal to be considered for access.

  • [admin_roles] Array optional

    Optional array of Role SysIDs that should be considered for administrative override.

  • [user_id] GlideRecord | String optional

    Optional indicator for the User to be considered for access. Defaults to the sessions current User.

Returns:

Boolean:

True if the user has access, false otherwise.

hasPortalAccess

(
  • record
  • [admin_roles]
  • [user_id]
)
Boolean

Checks access to a portal against the portal's Content Creator's list.

This method handles checking the parental relationship of the passed object and will navigate any needed relationship lookups to find the related portal.

Parameters:

  • record GlideRecord
  • [admin_roles] Array optional

    Optional array of Role SysIDs that should be considered for administrative override.

  • [user_id] GlideRecord | String optional

    Optional indicator for the User to be considered for access. Defaults to the sessions current User.

Returns:

Boolean:

True if the user has access, false otherwise.

isFalse

(
  • value
)
Boolean private static

Determine if a value should be considered true.

Due to a variety of ways of true/false values being returned by service now, this method exists to level set to a JavaScript boolean value for use.

Parameters:

Returns:

Boolean:

True if the value is considered as trying to be "true", false otherwise.

isFalse

(
  • value
)
Boolean private static

Determine if a value should be considered false.

Due to a variety of ways of true/false values being returned by service now, this method exists to level set to a JavaScript boolean value for use.

Parameters:

Returns:

Boolean:

True if the value is considered as trying to be "false", false otherwise.