-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
group.js
38 lines (35 loc) · 2.21 KB
/
group.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import Types from "../types.js";
/**
* SCIM Group Schema
* @alias SCIMMY.Schemas.Group
* @summary
* * Ensures a Group instance conforms to the Group schema set out in [RFC7643§4.2](https://datatracker.ietf.org/doc/html/rfc7643#section-4.2).
*/
export class Group extends Types.Schema {
/** @implements {SCIMMY.Types.Schema.definition} */
static get definition() {
return Group.#definition;
}
/** @private */
static #definition = new Types.SchemaDefinition("Group", "urn:ietf:params:scim:schemas:core:2.0:Group", "Group", [
new Types.Attribute("string", "displayName", {required: true, description: "A human-readable name for the Group. REQUIRED."}),
new Types.Attribute("complex", "members", {multiValued: true, uniqueness: false, description: "A list of members of the Group."}, [
new Types.Attribute("string", "value", {mutable: "immutable", description: "Identifier of the member of this Group."}),
new Types.Attribute("string", "display", {mutable: "immutable", description: "Human-readable name of the member of this Group."}),
new Types.Attribute("reference", "$ref", {mutable: "immutable", referenceTypes: ["User", "Group"], description: "The URI corresponding to a SCIM resource that is a member of this Group."}),
new Types.Attribute("string", "type", {mutable: "immutable", canonicalValues: ["User", "Group"], description: "A label indicating the type of resource, e.g., 'User' or 'Group'."})
])
]);
/**
* Instantiates a new group that conforms to the SCIM Group schema definition
* @extends SCIMMY.Types.Schema
* @param {Object} resource - the source data to feed through the schema definition
* @param {String} [direction="both"] - whether the resource is inbound from a request or outbound for a response
* @param {String} [basepath] - the base path for resolution of a resource's location
* @param {SCIMMY.Types.Filter} [filters] - attribute filters to apply to the coerced value
*/
constructor(resource, direction = "both", basepath, filters) {
super(resource, direction);
Object.assign(this, Group.#definition.coerce(resource, direction, basepath, filters));
}
}