我尝试使用等于电子邮件地址("demo@wildspaces.com")的用户名在MarkLogic中设置用户,似乎我可以创建用户但不能创建相应的角色.
我创建了用户,但是当我想添加一个角色时,就像这样:
sec.userAddRoles(user,role)
Run Code Online (Sandbox Code Playgroud)
这给出了一个错误:
2016-03-11 20:00:48.820 Notice: api-cluey-app: in /v1/projects.sjs, at 182:26, in projPost() [javascript]
2016-03-11 20:00:48.820 Notice: api-cluey-app: in [anonymous], at 1:67,
2016-03-11 20:00:48.820 Notice: api-cluey-app: in xdmp:eval("declareUpdate(); var sec = require('/MarkLogic/security.xqy'); s...", {role:"scc-proj-8327360-owner", user:"bill@wildspaces.com"}, {isolation:"different-transaction", userId:"11821709629759202109", database:"17312114676051821586"}) [javascript]
2016-03-11 20:00:48.820 Notice: api-cluey-app: in /v1/projects.sjs [javascript]
2016-03-11 20:00:48.820 Notice: api-cluey-app: in /v1/projects.sjs [javascript]
2016-03-11 20:00:49.416 Info: api-cluey-app: Status 500: XDMP-LEXVAL: sec:role-name("bill@wildspaces.com") -- Invalid lexical value "demo@wildspaces.com"
Run Code Online (Sandbox Code Playgroud)
如果我试着查看管理员安全数据库,它会变得更糟:
You've encountered an error in the server. If you have a maintenance contract, you can open a support ticket by copying the text below and emailing support@marklogic.com. Otherwise, please see our community Q & A resources for help with this issue:
500: Internal Server Error
XDMP-LEXVAL: sec:role-name("demo@wildspaces.com") -- Invalid lexical value "demo@wildspaces.com"
In /MarkLogic/Admin/lib/session.xqy on line 595
In get-session-role()
$role = ()
$u = fn:doc("http://marklogic.com/xdmp/roles/6750406636815962640")/sec:role
In /MarkLogic/Admin/lib/nav-format.xqy on line 2486
In role-nav("security", "summary", "role", "")
$section = "security"
$panel = "summary"
$param = "role"
$icon = ""
$t = "section=security"
$npan = "summary"
$u = fn:doc("http://marklogic.com/xdmp/roles/6966198486234205304")/sec:role
$uid = fn:doc("http://marklogic.com/xdmp/roles/6966198486234205304")/sec:role/sec:role-id
$args = "section=security&role=6966198486234205304"
$uname = sec:role-name("davida")
In /MarkLogic/Admin/lib/nav-format.xqy on line 2392
In security-nav("security", "summary", "role", "")
$section = "security"
$panel = "summary"
$param = "role"
$icon = ""
$panel = "summary"
In /MarkLogic/Admin/lib/nav-format.xqy on line 2358
In printNav("security", "summary", "role", "")
$section = "security"
$panel = "summary"
$param = "role"
$icon = ""
$sec = "security"
$start-time = xs:dayTimeDuration("PT0.001403S")
In /MarkLogic/Admin/lib/role-summary-form.xqy on line 87
In roleSummaryPage()
In /role-summary.xqy on line 16
Run Code Online (Sandbox Code Playgroud)
所以我的问题是:有效的MarkLogic用户名和角色中允许哪些字符?似乎无法找到任何文件?
您可以在MarkLogic附带的模式中找到类型定义.在Mac上,他们在~/Library/MarkLogic/Config; 在Linux上,/opt/MarkLogic/Config/.有问题的架构是security.xsd,具有以下类型定义role-name:
<xs:simpleType name="role-name">
<xs:annotation>
<xs:documentation>
</xs:documentation>
<xs:appinfo>
</xs:appinfo>
</xs:annotation>
<xs:restriction base="xs:NMTOKEN">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
Run Code Online (Sandbox Code Playgroud)
xs:NMTOKEN这里定义:https://www.w3.org/TR/xml11/#NT-Nmtoken.这是一个有效的NameStartChar后跟任意数量的NameChar.换句话说,它是一个有效的XML本地名称.(更新:这是不正确的; XML本地名称比NMTOKEN更具限制性.)
在XQuery中,您可以检查有效的名称,如下所示:
"demo@wildspaces.com" castable as xs:NMTOKEN
Run Code Online (Sandbox Code Playgroud)
返回false.
更新:
对不起,我错过了后续问题.
所有XML Schema类型都有内置的构造函数/转换函数,它们通过对其参数应用类型转换来工作.那些类型构造器在全局xs对象下的服务器端JS中可用:
var isValid
try {
isValid = !!xs.NMTOKEN("test%")
} catch(err) {
isValid = false
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
82 次 |
| 最近记录: |