Type Permissions

Type permissions determine if a principal, a user or user group, has access to a type. SmartEdit uses these permissions to determine which types a principal read, change, create, or remove. Principals with permissions to a type also have access to all the attributes defined of the type, unless more specific attribute permissions are assigned.

Type Permission Hierarchy

All permissions defined for the parent type are propagated to the children types. Any child type can provide more specific access rights to override the parent type's configuration.

The diagram above shows the permission hierarcy. The permissions in the diagram are as follows:

  • CMS Item type: The CMS Item is the parent type. The principal has the permission to perform CRUD operations on this type.
  • Abstract Page type: The Abstract Page type is a child type of the CMS Item type. It inherits all its access rights from the parent type, but the principal does not have DELETE permissions to the Abstract Page type.
  • Category Page type: The Category Page type is a child type of the Abstract Page type. The principal does not have CREATE permission to it. Therefore, the principal does not have the permission to create or delete any category pages.
  • Product Page type: The Product Page type is a child type of the Abstract Page type. The principal does not have UPDATE permission but does have DELETE permission, which overrides the configuration defined in its parent type, Abstract Page type. This means that the principal has the permission to delete but not to update product pages. Therefore, the principal has the permission to delete but not to update any product pages.

Type and Attribute Permissions Priority

The order that SmartEdit applies permissions to a principal also follows a hierarchy. In general, more specific access rights take precedence over more general ones. This means that SmartEdit adheres to the access rights assigned to an attribute over the rights assigned for an item. For example, if a principal has READ permission to all items of the ContentPage type but does not have READ permission for the Name attribute, the principal can read all the attributes of the ContentPage type with the exception of the Name attribute.

Backend Implementation

In the backend, SmartEdit uses various extensions and APIs to retrieve type permission information for principals. Which endpoint and API it uses depends on the type that a principals tries to read, create, edit, or delete. SmartEdit uses the following APIs:

  • CMS Item API
  • CMS Versions API
  • PageTemplate API
  • PageType API
  • Permission API

Permission API

The permissionswebservices extension provides the types endpoint of the Permission API to retrieve type permissions for a principal. The following code shows the request made to retrieve permission information for a principal:

GET /permissionswebservices/v1/permissions/principals/{principalUid}/types?permissionNames={permission_names}&types={type_codes}

The following code excerpt shows the GET request made to retrieve the type permissions for a cmsmanager to verify if the cmsmanager has the rights to perform CRUD operations on content pages. It also shows the corresponding response.

Request:
GET /permissionswebservices/v1/permissions/principals/cmsmanager/types?permissionNames=create,change,read,remove&types=ContentPage

Response:
{
   "permissionsList" : [ {
      "id" : "ContentPage",
      "permissions" : [ {
         "key" : "read",
         "value" : "true"
      }, {
         "key" : "change",
         "value" : "true"
      }, {
         "key" : "create",
         "value" : "true"
      }, {
         "key" : "remove",
         "value" : "true"
      } ]
   } ]
}

Type Permission Checking for the CMS Item API

Type permissions are applied to all requests made to the CMS Item API defined in the cmswebservices extension. The following table shows the request made to the endpoint, the permissions required by the principal and the target type, as well as a description.

Request Required Permission Description
GET /cmswebservices/v1/sites/{siteId}/cmsitems/{uuid} READ on the item type To retrieve an item, a GET request is made to the CMS Item API that includes the item's UUID. The principal's credentials and identity are resolved from the authorization token included in the request header. The principal must have READ permission on the item type, otherwise a type permission error is returned.
GET /cmswebservices/v1/sites/{siteId}/cmsitems/{uuid}?versionId={versionId} READ on the CMSVersion type To retrieve a versionned representation of an item, a GET request is made to the CMS Item API that includes the item's UUID of the versionned item and the versionId. The principal must have READ permission on the CMSVersion type, otherwise a type permission error is returned.
POST /cmswebservices/v1/sites/{siteId}/cmsitems CREATE on the item type To create a CMS item, a POST request is made to the CMS Item API. The principal must have CREATE permission on the item type, otherwise a type permission error is returned.
PUT /cmswebservices/v1/sites/{siteId}/cmsitems/{uuid} CHANGE on the item type To modify a specific item, a PUT request is made to the CMS Item API. The principal must have CHANGE permission on the item type, otherwise a type permission error is returned.
DELETE /cmswebservices/v1/sites/{siteId}/cmsitems/{uuid} REMOVE on the item type To delete a given item, a DELETE request is made to the CMS Item API. The principal must have REMOVE permission on the item type, otherwise a type permission error is returned.
POST /cmswebservices/v1/sites/{siteId}/cmsitems/uuids READ on the item type for all UUIDs passed To retrieve a list of items, a GET request is made to the CMS Item API that includes the items' UUIDs. The principal must have READ permission on all the items' types, otherwise a type permission error is returned.

Type Permission Checking for the Page Type and Page Template APIs

Type permissions are applied to all requests made to the Page Typeand Page Template API defined in the cmswebservices extension. The following table provides the request made to the Page Type and Page Template APIs, the type permissions required by the principal and the target type, as well as a description.

Request Required Permission Description

GET /cmswebservices/v1/pagetypes

READ on pageType

To retrieve a list of page types, a GET request is made is made to the PageType API. The principal must have READ permission on the pageType type, otherwise the page type is not included in the response. If a principal doesn't have any permissions to any page types, an empty list is returned.

GET /cmswebservices/v1/sites/{siteId}/catalogs/{catalogId}/versions/{versionId}/pagetemplates?pageTypeCode={typecode}

READ on pageType and

READ on pageTemplate

To retrieve a list of page templates for a specific page type, a GET request is made to the PageTemplate API. The principal must have READ permission on the pageType and on the pageTemplate types. If the principal doesn't have any permissions on the pageType, an empty list is returned. If the principal doiesn't have any permissions on the pageTemplate type, a type permission error is returned.

Type Permission Checking for the CMS Version API

Type permissions are applied to all requests made to the CMS Version API defined in the cmswebservices extension. The following table provides the requests made to the API, the permissions required by the principal, as well as a description.

Request Required Permission Description

POST /cmswebservices/v1/sites/{siteId}/cmsitems/{uuid}/versions

CREATE on CMSVersion and

READ on CMSItem

To create a version, a POST request is made to the CMSVersion API. The principal must have CREATE permission on the CMSVersion and READ permission on the CMSItem type, otherwise a type permission error is returned.

DELETE /cmswebservices/v1/sites/{siteId}/cmsitems/{uuid}/versions/{versionId}

REMOVE and READ on CMSVersion and

READ on CMSItem

To delete a version, a DELETE request is made to the CMSVersion API. The principal must have REMOVE and READ permissions on the CMSVersion type and READ permission on the CMSItem type, otherwise a type permission error is returned.

GET /cmswebservices/v1/sites/{siteId}/cmsitems/{uuid}/versions/{versionId}

READ on CMSVersion

To retrieve information about a version, a GET request is made to the CMS Version API. The principal must have READ permission on the CMSVersion type, otherwise a type permission error is returned.

POST /cmswebservices/v1/sites/{siteId}/cmsitems/{uuid}/versions/{versionId}/rollbacks

CREATE (for auto-version), READ on CMSVersion and

READ and CHANGE on CMSItem

To rollback an item to a previously saved version, a POST request is made to the CMSVersion API. The principal must have READ permission on the CMSVersion type, as well as READ and CHANGE permissions on the CMSItem type, otherwise a type permission error is returned.

PUT /cmswebservices/v1/sites/{siteId}/cmsitems/{uuid}/versions/{versionId}

READ and CHANGE on CMSVersion

To update a version, a PUT request is made to the CMSVersion API. The principal must have READ and CHANGE permissions on the CMSVersion type, otherwise a type permission error is returned.

GET /cmswebservices/v1/sites/{siteId}/cmsitems/{uuid}/versions?mask={filterText}&pageSize={numEntriesPerPage}&currentPage={pageIndex}&sort={sortFieldAndOrder}

READ on CMSVersion

To retrieve a list of versions filtered by a mask value, a GET request is made to the CMSVersion API. The principal must have READ permission on the CMSVersion type, otherwise a type permission error is returned.

Frontend Implementation

The frontend uses the information provided by different APIs in the backend to determine what functionality SmartEdit displays to the user and what functionality a user can read, create, modify, or delete. The frontend does not process type permissions. It reacts to the data provided by the CMS Item API, CMS Version API, Page Template API, Page Type API and the Permission API.

Configuring Permissions

Type permissions determine if a user has access to the item type. SmartEdit uses these permissions to determine which types are available to the user and which types the user can read, create, change, or remove while performing different operations.

Type permissions have been impexed for all existing users. However, you must configure type permissions for all new users. You can configure the type permissions in the Backoffice Administration Cockpit or by impex.

Configuring Type Permissions in the Backoffice Administration Cockpit

  1. Log into the Backoffice as the admin user.

  2. Go to Start of the navigation pathUser Next navigation step EmployeesEnd of the navigation path in the navigation tree.

  3. In the list, select the user you want to configure type permissions for.

  4. Click on the key button to access the Permission Management - Employee window.

  5. Search through the list for the types that you want to assign to the user.

  6. Modify the permissions for the types as required.

    Your changes are automatically saved.

    Reload SmartEdit for the changes to updated in the UI.

Configuring Type Permissions by Impex

  1. Set up a file to import the permissions for your new users as shown in the following file example:

    $START_USERRIGHTS;;;;;;;;;
    Type;UID;MemberOfGroups;Password;Target;read;change;create;remove;change_perm
    UserGroup;cmsmanagergroup;basecmsmanagergroup,employeegroup;;;;;;;
    
    
    ;;;;CMSItem;+;+;;;;
    ;;;AbstractCMSComponent;+;+;+;+;+;
    
    
    $END_USERRIGHTS;;;;;
  2. Import the impex file into your SAP Commerce Cloud.