@umbraco/json-models-builders
Version:
Builders and models for Umbraco Sites
232 lines • 7.28 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserGroupsPermissionsBaseBuilder = void 0;
class UserGroupsPermissionsBaseBuilder {
parentBuilder;
// Document permissions
readDocument = false;
createDocumentBlueprint = false;
deleteDocument = false;
createDocument = false;
notificationsDocument = false;
publishDocument = false;
setPermissionsDocument = false;
unpublishDocument = false;
updateDocument = false;
duplicateDocument = false;
moveToDocument = false;
sortChildrenDocument = false;
cultureAndHostnamesDocument = false;
publicAccessDocument = false;
rollbackDocument = false;
readPropertyValueDocument = false;
writePropertyValueDocument = false;
// Element permissions
readElement = false;
createElement = false;
deleteElement = false;
publishElement = false;
unpublishElement = false;
updateElement = false;
duplicateElement = false;
moveElement = false;
rollbackElement = false;
constructor(parentBuilder) {
this.parentBuilder = parentBuilder;
}
// Document permission methods
withReadDocumentPermission(read) {
this.readDocument = read;
return this;
}
withCreateDocumentBlueprintPermission(createDocumentBlueprint) {
this.createDocumentBlueprint = createDocumentBlueprint;
return this;
}
withDeleteDocumentPermission(deletePermission) {
this.deleteDocument = deletePermission;
return this;
}
withCreateDocumentPermission(createPermission) {
this.createDocument = createPermission;
return this;
}
withNotificationsDocumentPermission(notifications) {
this.notificationsDocument = notifications;
return this;
}
withPublishDocumentPermission(publish) {
this.publishDocument = publish;
return this;
}
withSetPermissionsDocumentPermission(setPermissions) {
this.setPermissionsDocument = setPermissions;
return this;
}
withUnpublishDocumentPermission(unpublish) {
this.unpublishDocument = unpublish;
return this;
}
withUpdateDocumentPermission(update) {
this.updateDocument = update;
return this;
}
withDuplicateDocumentPermission(duplicate) {
this.duplicateDocument = duplicate;
return this;
}
withMoveToDocumentPermission(moveTo) {
this.moveToDocument = moveTo;
return this;
}
withSortChildrenDocumentPermission(sortChildren) {
this.sortChildrenDocument = sortChildren;
return this;
}
withCultureAndHostnamesDocumentPermission(cultureAndHostnames) {
this.cultureAndHostnamesDocument = cultureAndHostnames;
return this;
}
withPublicAccessDocumentPermission(publicAccess) {
this.publicAccessDocument = publicAccess;
return this;
}
withRollbackDocumentPermission(rollback) {
this.rollbackDocument = rollback;
return this;
}
withReadPropertyValueDocumentPermission(readPropertyValue) {
this.readPropertyValueDocument = readPropertyValue;
return this;
}
withWritePropertyValueDocumentPermission(writePropertyValue) {
this.writePropertyValueDocument = writePropertyValue;
return this;
}
// Element permission methods
withReadElementPermission(read) {
this.readElement = read;
return this;
}
withCreateElementPermission(create) {
this.createElement = create;
return this;
}
withDeleteElementPermission(deletePermission) {
this.deleteElement = deletePermission;
return this;
}
withPublishElementPermission(publish) {
this.publishElement = publish;
return this;
}
withUnpublishElementPermission(unpublish) {
this.unpublishElement = unpublish;
return this;
}
withUpdateElementPermission(update) {
this.updateElement = update;
return this;
}
withDuplicateElementPermission(duplicate) {
this.duplicateElement = duplicate;
return this;
}
withMoveElementPermission(move) {
this.moveElement = move;
return this;
}
withRollbackElementPermission(rollback) {
this.rollbackElement = rollback;
return this;
}
done() {
return this.parentBuilder;
}
build() {
let values = [];
// Document permissions
if (this.readDocument) {
values.push('Umb.Document.Read');
}
if (this.createDocumentBlueprint) {
values.push('Umb.Document.CreateBlueprint');
}
if (this.deleteDocument) {
values.push('Umb.Document.Delete');
}
if (this.createDocument) {
values.push('Umb.Document.Create');
}
if (this.notificationsDocument) {
values.push('Umb.Document.Notifications');
}
if (this.publishDocument) {
values.push('Umb.Document.Publish');
}
if (this.setPermissionsDocument) {
values.push('Umb.Document.Permissions');
}
if (this.unpublishDocument) {
values.push('Umb.Document.Unpublish');
}
if (this.updateDocument) {
values.push('Umb.Document.Update');
}
if (this.duplicateDocument) {
values.push('Umb.Document.Duplicate');
}
if (this.moveToDocument) {
values.push('Umb.Document.Move');
}
if (this.sortChildrenDocument) {
values.push('Umb.Document.Sort');
}
if (this.cultureAndHostnamesDocument) {
values.push('Umb.Document.CultureAndHostnames');
}
if (this.publicAccessDocument) {
values.push('Umb.Document.PublicAccess');
}
if (this.rollbackDocument) {
values.push('Umb.Document.Rollback');
}
if (this.readPropertyValueDocument) {
values.push('Umb.Document.PropertyValue.Read');
}
if (this.writePropertyValueDocument) {
values.push('Umb.Document.PropertyValue.Write');
}
// Element permissions
if (this.readElement) {
values.push('Umb.Element.Read');
}
if (this.createElement) {
values.push('Umb.Element.Create');
}
if (this.deleteElement) {
values.push('Umb.Element.Delete');
}
if (this.publishElement) {
values.push('Umb.Element.Publish');
}
if (this.unpublishElement) {
values.push('Umb.Element.Unpublish');
}
if (this.updateElement) {
values.push('Umb.Element.Update');
}
if (this.duplicateElement) {
values.push('Umb.Element.Duplicate');
}
if (this.moveElement) {
values.push('Umb.Element.Move');
}
if (this.rollbackElement) {
values.push('Umb.Element.Rollback');
}
return values;
}
}
exports.UserGroupsPermissionsBaseBuilder = UserGroupsPermissionsBaseBuilder;
//# sourceMappingURL=userGroupsPermissionsBaseBuilder.js.map