4

我正在调用 sec:role-exists()。我试图弄清楚需要哪些权限才能将此功能授予管理员以外的其他人。我回来的错误意味着我需要http://marklogic.com/xdmp/privileges/get-role权限。

SEC-PRIVDNE: xdmp:security-assert("http://marklogic.com/xdmp/privileges/get-role", "execute") -- Privilege does not exist: action(http://marklogic.com/xdmp/privileges/get-role), kind(execute)

但是,当我尝试通过 sec:privilege-add-roles 使用管理员帐户授予此角色时,它告诉我该权限不存在。

[1.0-ml] SEC-PRIVDNE: (err:FOER0000) Privilege does not exist: action(http://marklogic.com/xdmp/privileges/get-role), kind(execute)

有任何想法吗?

这是我用来授予的代码片段,我以管理员身份运行。

(: grant the needed privileges to the role :)
let $grant_privs :=
xdmp:invoke-function(
  function() {
    let $required_roles := (
      "http://marklogic.com/xdmp/privileges/create-role",
      "http://marklogic.com/xdmp/privileges/remove-role",
      "http://marklogic.com/xdmp/privileges/get-role-ids",
      "http://marklogic.com/xdmp/privileges/get-role-names",
      "http://marklogic.com/xdmp/privileges/get-role",
      "http://marklogic.com/xdmp/privileges/xdmp-invoke-in",
      "http://marklogic.com/xdmp/privileges/xdmp-invoke"
    )

    return
      for $r in $required_roles
        return
          sec:privilege-add-roles(
            $r,
            "execute",
            "auth-lib"
          )
  },
  <options xmlns="xdmp:eval">
    <database>{ xdmp:security-database() }</database>
    <transaction-mode>update-auto-commit</transaction-mode>
    <isolation>different-transaction</isolation>
  </options>
)
4

1 回答 1

7

安装时未创建权限实际上是一个错误。这将在下一个版本中得到纠正,但在此期间,您可以在安全数据库中手动创建它。

sec:create-privilege(
  "role-exists",
  "http://marklogic.com/xdmp/privileges/get-role",
  "execute",
  "security")
于 2016-02-17T01:11:28.293 回答