All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.

RangePermissionCollection Class

A collection of RangePermission objects.

Declaration

export class RangePermissionCollection extends Collection<RangePermission>

Remarks

Range permissions are in effect when a document is protected. To protect a document, use the protect(password) method.

Inherited Members

Inheritance

Collection<T>
RangePermissionCollection

Methods

create(interval) Method

Creates a range permission that allows a user/group to edit the specified interval.

Declaration

create(
    interval: IInterval,
    userName?: string,
    group?: string
): RangePermission

Parameters

Name Type Description
interval IInterval

An object that specifies the permitted range.

userName string

The name of the user with edit permission.

group string

The name of the user group with edit permission.

Returns

Type Description
RangePermission

The newly created range permission.

Remarks

Allow a user/group to edit a range.
richEdit.document.rangePermissions.create({ start: 0, length: richEdit.document.paragraphs.getByIndex(5).interval.end}, 'projectmanager@somecompany.com');
richEdit.document.rangePermissions.create(richEdit.document.paragraphs.getByIndex(6).interval, '', 'editors');
Allow a user/group to edit the entire document.
richEdit.document.rangePermissions.create(richEdit.document.interval, 'projectmanager@somecompany.com');
richEdit.document.rangePermissions.create(richEdit.document.interval, '', 'owners');
Allow everyone to edit a range.

Use the everyone predefined group to allow every user to edit the specified range.

richEdit.document.rangePermissions.create(richEdit.document.paragraphs.getByIndex(10).interval, '', 'everyone');
// or
richEdit.document.rangePermissions.create(richEdit.document.paragraphs.getByIndex(10).interval);

Refer to the following help topic for more information: Document Protection.

find(options) Method

Returns a range permission array that matches the specified options.

Declaration

find(
    options: IRangePermissionSearchOptions
): RangePermission[]

Parameters

Name Type Description
options IRangePermissionSearchOptions

An object that specifies range permission options.

Returns

Type Description
RangePermission[]

An array of range permissions.

Remarks

var everyoneRangePermissions = richEdit.document.rangePermissions.find({group: 'everyone'});

isAllowEdit(position) Method

Indicates whether the specified range can be edited.

Declaration

isAllowEdit(
    position: number | IInterval | IInterval[]
): boolean

Parameters

Name Type Description
position number | IInterval | IInterval[]

A document position, an interval, or an array of intervals.

Returns

Type Description
boolean

true, if the specified range can be edited; false if the specified range is protected or contains protected intervals.

Remarks

richEdit.document.rangePermissions.isAllowEdit(richEdit.selection.active);
richEdit.document.rangePermissions.isAllowEdit(richEdit.document.paragraphs.getByIndex(4).interval);

protectRange(intervals) Method

Creates range permissions that protect the specified interval from being edited.

Declaration

protectRange(
    intervals: IInterval[],
    userName?: string,
    group?: string
): RangePermission[]

Parameters

Name Type Description
intervals IInterval[]

An object that specifies the protected range.

userName string

The name of the user who is prohibited from editing the range.

group string

The name of the user group that is prohibited from editing the range.

Returns

Type Description
RangePermission[]

An array of newly created range permissions.

Remarks

The protectRange method creates range permissions (objects of the RangePermission type) that prevent the specified document range from being edited. You can specify the user or a group of users who are prohibited from editing the range.

Prevent a user/group from editing a range.
richEdit.document.rangePermissions.protectRange([{ start: 0, length: 178}, { start: 325, length: 561}], 'lawyer@somecompany.com');
richEdit.document.rangePermissions.protectRange([richEdit.document.paragraphs.getByIndex(6).interval], '', 'editors');
Prevent everyone from editing a range.

Use the everyone predefined group to prevent every user from editing the specified range.

richEdit.document.rangePermissions.protectRange([richEdit.document.paragraphs.getByIndex(10).interval], '', 'everyone');
// or
richEdit.document.rangePermissions.protectRange([richEdit.document.paragraphs.getByIndex(10).interval]);

Refer to the following help topic for more information: Document Protection.