如何授予http://marklogic.com/xdmp/privileges/get-role权限?

TJ *_*ang 4 marklogic marklogic-8

我正在调用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)
Run Code Online (Sandbox Code Playgroud)

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

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

有任何想法吗?

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

(: 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>
)
Run Code Online (Sandbox Code Playgroud)

小智 7

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

sec:create-privilege(
  "role-exists",
  "http://marklogic.com/xdmp/privileges/get-role",
  "execute",
  "security")
Run Code Online (Sandbox Code Playgroud)