如何在 Kentico API 中赋予角色对节点的创建和删除权限?

How to give a role create and delete permissions to a node in Kentico API?

我正在使用以下示例通过 Kentico API 更新树节点上的角色权限:

https://docs.kentico.com/api11/content-management/page-security#Pagesecurity-Settingpagepermissionsforarole

无法弄清楚如何分配多个权限,例如允许创建和允许删除。非常感谢任何例子。

将您从权限标志方法获得的所有值求和并保存:

    if (role != null)
    {
        int allowed = DocumentSecurityHelper.GetNodePermissionFlags(NodePermissionsEnum.Create);
        allowed += DocumentSecurityHelper.GetNodePermissionFlags(NodePermissionsEnum.Delete);
        // Prepares a value indicating that no page permissions are denied
        int denied = 0;

        AclItemInfoProvider.SetRolePermissions(page, allowed, denied, role);
    }