【问题标题】:How to grant http://marklogic.com/xdmp/privileges/get-role privilege?如何授予 http://marklogic.com/xdmp/privileges/get-role 权限?
【发布时间】:2016-05-28 09:08:18
【问题描述】:

我正在调用 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)

有什么想法吗?

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

(: 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>
)

【问题讨论】:

  • 你能贴出你用来创建权限的代码吗?
  • 我已更新问题以包含代码。

标签: marklogic marklogic-8


【解决方案1】:

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

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

【讨论】:

  • 我对安全数据库执行了此操作,并将此权限的执行权限授予相关用户帐户。现在调用不再无法实际授予权限。但是对 sec:role-exists() 的调用总是返回 false,即使角色确实存在。有什么想法吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-22
  • 2016-08-24
  • 2015-01-23
  • 1970-01-01
相关资源
最近更新 更多