UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

840 lines 34.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UserGroupApiHelper = void 0; const json_models_builders_1 = require("@umbraco/json-models-builders"); const ConstantHelper_1 = require("./ConstantHelper"); class UserGroupApiHelper { api; constructor(api) { this.api = api; } async ensureNameNotExists(name) { const json = await this.getAll(); for (const sb of json.items) { if (sb.name === name) { if (sb.id !== null) { return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/user-group/' + sb.id); } } } return null; } async doesExist(id) { const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/user-group/' + id); return response.status() === 200; } async create(userGroupData) { const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/user-group', userGroupData); // Returns the id of the userGroup return response.headers().location.split("/").pop(); } async getByName(name) { const json = await this.getAll(); for (const sb of json.items) { if (sb.name === name) { if (sb.id !== null) { const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/user-group/' + sb.id); return await response.json(); } } } return null; } async get(id) { const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/user-group/' + id); const json = await response.json(); if (json !== null) { return json; } return null; } async getAll() { const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/user-group?skip=0&take=10000'); const json = await response.json(); if (json !== null) { return json; } return null; } async update(id, userGroup) { const response = await this.api.put(this.api.baseUrl + '/umbraco/management/api/v1/user-group/' + id, userGroup); return response.text(); } async doesNameExist(name) { const json = await this.getAll(); for (const sb of json.items) { if (sb.name === name) { return true; } } return false; } async doesUserGroupContainLanguage(userGroupName, languageName) { const userGroup = await this.getByName(userGroupName); return userGroup.languages.includes(languageName); } async doesUserGroupContainAccessToAllLanguages(userGroupName) { const userGroup = await this.getByName(userGroupName); return userGroup.hasAccessToAllLanguages; } async doesUserGroupContainDocumentRootAccess(userGroupName) { const userGroup = await this.getByName(userGroupName); return userGroup.documentRootAccess; } async doesUserGroupContainMediaRootAccess(userGroupName) { const userGroup = await this.getByName(userGroupName); return userGroup.mediaRootAccess; } async delete(id) { return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/user-group/' + id); } async createEmptyUserGroup(name) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .build(); return await this.create(userGroup); } async createSimpleUserGroupWithContentSection(name) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .addFallbackPermission() .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createSimpleUserGroupWithMediaSection(name) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Media') .addFallbackPermission() .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithDocumentAccess(name) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .withDocumentRootAccess(true) .build(); return await this.create(userGroup); } async createUserGroupWithDocumentStartNode(name, startNodeId) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(false) .withDocumentStartNodeId(startNodeId) .addFallbackPermission() .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithMediaStartNode(name, startNodeId) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Media') .withMediaRootAccess(false) .withMediaStartNodeId(startNodeId) .addFallbackPermission() .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithLanguage(name, languageName) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addLanguage(languageName) .build(); return await this.create(userGroup); } async createUserGroupWithLanguageAndContentSection(name, languageName) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .addLanguage(languageName) .withDocumentRootAccess(true) .addFallbackPermission() .withReadPermission(true) .withUpdatePermission(true) .withReadPropertyValuePermission(true) .withWritePropertyValuePermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithMemberSection(name) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Members') .build(); return await this.create(userGroup); } async createUserGroupWithPermissionsForSpecificDocumentWithRead(name, documentId) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithReadPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withReadPermission(enabled) .done() .build(); return await this.create(userGroup); } async createUserGroupWithCreateDocumentBlueprintPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withCreateDocumentBlueprintPermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithDeleteDocumentPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withDeletePermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithCreateDocumentPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withCreatePermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithNotificationsPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withNotificationsPermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithPublishPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withPublishPermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithSetPermissionsPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withSetPermissionsPermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithUnpublishPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withUnpublishPermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithUpdatePermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withUpdatePermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithDuplicatePermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withDuplicatePermission(enabled) .withCreatePermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithMoveToPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withMoveToPermission(enabled) .withCreatePermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithSortChildrenPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withSortChildrenPermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithCultureAndHostnamesPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withCultureAndHostnamesPermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithPublicAccessPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .addSection('Umb.Section.Members') .withDocumentRootAccess(true) .addFallbackPermission() .withPublicAccessPermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithRollbackPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withRollbackPermission(enabled) .withReadPermission(true) .withReadPropertyValuePermission(true) .done() .build(); return await this.create(userGroup); } async createUserGroupWithDeletePermissionAndCreatePermission(name, deleteEnabled = true, createEnabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withDeletePermission(deleteEnabled) .withCreatePermission(createEnabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } async doesUserGroupContainContentStartNodeId(userGroupName, documentStartNodeId) { const userGroup = await this.getByName(userGroupName); if (userGroup.documentStartNode === null) { return false; } return userGroup.documentStartNode.id.includes(documentStartNodeId); } async doesUserGroupContainMediaStartNodeId(userGroupName, mediaStartNodeId) { const userGroup = await this.getByName(userGroupName); if (userGroup.mediaStartNode === null) { return false; } return userGroup.mediaStartNode.id.includes(mediaStartNodeId); } async doesUserGroupContainGranularPermissionsForDocument(userGroupName, documentId, granularPermissions) { const userGroup = await this.getByName(userGroupName); for (const permission of userGroup.permissions) { if (permission.document.id === documentId) { for (const verb of permission.verbs) { if (!granularPermissions.includes(verb)) { return false; } } return true; } } return false; } async doesUserGroupHaveFallbackPermissions(userGroupName, permissions) { const userGroup = await this.getByName(userGroupName); const fallbackPermissions = userGroup.fallbackPermissions; if (permissions.length !== fallbackPermissions.length) { return false; } return permissions.every(item => fallbackPermissions.includes(item)); } async convertApiPermissionsToUiPermissions(apiPermissions) { return apiPermissions.map(permission => { for (const key in ConstantHelper_1.ConstantHelper.userGroupPermissionsSettings) { if (ConstantHelper_1.ConstantHelper.userGroupPermissionsSettings[key][2].toLowerCase() === permission.toLowerCase()) { return ConstantHelper_1.ConstantHelper.userGroupPermissionsSettings[key][0]; } } return null; }); } async convertApiSectionsToUiSections(apiSections) { return apiSections.map(permission => { for (const key in ConstantHelper_1.ConstantHelper.userGroupSectionsSettings) { if (ConstantHelper_1.ConstantHelper.userGroupSectionsSettings[key][1].toLowerCase() === permission.toLowerCase()) { return ConstantHelper_1.ConstantHelper.userGroupSectionsSettings[key][0]; } } return null; }); } async doesUserGroupHaveSections(userGroupName, sections) { const userGroup = await this.getByName(userGroupName); const sectionsData = userGroup.sections; if (sectionsData.length !== sections.length) { return false; } return sections.every(item => sectionsData.includes(item)); } async createUserGroupWithReadPermissionAndReadPropertyValuePermission(name, readEnabled = true, readPropertyValueEnabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withReadPermission(readEnabled) .withReadPropertyValuePermission(readPropertyValueEnabled) .done() .build(); return await this.create(userGroup); } async createUserGroupWithUpdatePermissionAndWritePropertyValuePermission(name, updateEnabled = true, writePropertyValueEnabled = true, readPropertyValueEnabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withUpdatePermission(updateEnabled) .withReadPermission(true) .withWritePropertyValuePermission(writePropertyValueEnabled) .withReadPropertyValuePermission(readPropertyValueEnabled) .done() .build(); return await this.create(userGroup); } async createUserGroupWithPermissionsForSpecificDocumentAndTwoPropertyValues(name, documentId, documentTypeId, firstPropertyValueName, readFirstPropertyValueEnabled = true, writeFirstPropertyValueEnabled = true, secondPropertyValueName, readSecondPropertyValueEnabled = true, writeSecondPropertyValueEnabled = true) { await this.ensureNameNotExists(name); const firstPropertyValueId = await this.api.documentType.getPropertyIdWithName(documentTypeId, firstPropertyValueName); const secondPropertyValueId = await this.api.documentType.getPropertyIdWithName(documentTypeId, secondPropertyValueName); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withReadPermission(true) .withUpdatePermission(true) .done() .done() .addPropertyValuePermission() .withDocumentTypeId(documentTypeId) .withPropertyTypeId(firstPropertyValueId) .addVerbs() .withReadPropertyValuePermission(readFirstPropertyValueEnabled) .withWritePropertyValuePermission(writeFirstPropertyValueEnabled) .done() .done() .addPropertyValuePermission() .withDocumentTypeId(documentTypeId) .withPropertyTypeId(secondPropertyValueId) .addVerbs() .withReadPropertyValuePermission(readSecondPropertyValueEnabled) .withWritePropertyValuePermission(writeSecondPropertyValueEnabled) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithReadPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withReadPermission(enabled) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithCreateDocumentBlueprintPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withCreateDocumentBlueprintPermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithDeletePermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withDeletePermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithCreatePermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withCreatePermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithNotificationsPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withNotificationsPermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithPublishPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withPublishPermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithSetPermissionsPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withSetPermissionsPermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithUnpublishPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withUnpublishPermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithUpdatePermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withReadPermission(true) .done() .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withUpdatePermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithDuplicatePermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withCreatePermission(true) // need to have the 'create' permission - refer this PR: https://github.com/umbraco/Umbraco-CMS/pull/19303 .done() .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withDuplicatePermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithMoveToPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withCreatePermission(true) // need to have the 'create' permission - refer this PR: https://github.com/umbraco/Umbraco-CMS/pull/19303 .done() .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withMoveToPermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithSortChildrenPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withSortChildrenPermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithCultureAndHostnamesPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withCultureAndHostnamesPermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithPublicAccessPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .addSection('Umb.Section.Members') .withDocumentRootAccess(true) .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withPublicAccessPermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithRollbackPermissionForSpecificDocument(name, documentId, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withReadPropertyValuePermission(true) .withWritePropertyValuePermission(true) .done() .addPermissions() .addDocumentPermission() .withDocumentId(documentId) .addVerbs() .withRollbackPermission(enabled) .withReadPermission(true) .done() .done() .done() .build(); return await this.create(userGroup); } async createUserGroupWithCreateAndUpdateDocumentPermission(name, enabled = true) { await this.ensureNameNotExists(name); const userGroup = new json_models_builders_1.UserGroupBuilder() .withName(name) .addSection('Umb.Section.Content') .withDocumentRootAccess(true) .addFallbackPermission() .withCreatePermission(enabled) .withUpdatePermission(enabled) .withReadPermission(true) .done() .build(); return await this.create(userGroup); } } exports.UserGroupApiHelper = UserGroupApiHelper; //# sourceMappingURL=UserGroupApiHelper.js.map