【问题标题】:How to give a role create and delete permissions to a node in Kentico API?如何在 Kentico API 中赋予角色创建和删除节点的权限?
【发布时间】:2019-02-06 20:43:57
【问题描述】:

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

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

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

【问题讨论】:

    标签: c# kentico kentico-api


    【解决方案1】:

    将从权限标志方法中获得的所有值汇总到 allowed 并保存:

        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);
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多