我想自定义Surf Platform Root-Scoped API 特别是用户对象.这意味着向用户对象添加新的属性或方法以检查用户是否在header.inc.ftl [in share] 中的某个组中,例如`<#if user.isAdmin>
I want to customize Surf Platform Root-Scoped API specifically user object. That means add new property or method to user object to check the user is in certain group in header.inc.ftl [in share] like `<#if user.isAdmin>
我不知道自定义冲浪平台根对象.谁能帮帮我???
I have no idea of customizing surf platform root object. Can anyone help me???
推荐答案不太确定您要实现的目标,但角色安全模型已硬编码在 spring-surf/spring webscripts 中.有访客、用户和管理员.如果您想要的是另一个类似的角色,您将不得不破解 spring-surf 库,即:
Not quite sure what you are trying to accomplish, but the role security model is hardcoded in spring-surf/spring webscripts. There is guest, user and admin. If what you want is another analogous role you'll have to hack the spring-surf libaries, namely:
org/springframework/extensions/surf/mvc/PageView.java org/springframework/extensions/webscripts/ScriptUser.java org/springframework/extensions/webscripts/Description.java org/springframework/extensions/webscripts/connector/User.java这是我实现user.isEmployee 所必须做的.这种方法可以让您真正像对待其他角色一样对待您的新角色.
This is what I had to do to implement user.isEmployee. This approach allows you to literally treat your new role just as the others.
你可以使用
<authentication>employee</authentication>在页面描述符中或
<item type="link" permission="employee" id="people">/people-finder</item>在导航上.
仅检查用户是否在某个 webscript 中的某个组中是完全不同的故事,并且不提供相同的功能.
Just checking whether the user is in a certain group in a certain webscript is a whole diffrent story and does not provide the same functionality.
如果你想要的是后者,你应该打电话给
If what you want is the latter, you should make a call to
/alfresco/service/api/groups/{shortName}想念并处理响应.
更新: 项目权限属性需要稍微调整一下.在 header.get.js 中,将新角色传播给它在 header.inc.ftl 中得到正确处理:
Update: The item permission attribute requires a little more tweaking. In header.get.js, propagate the new role to it gets processed properly in header.inc.ftl:
model.permissions = { guest: user.isGuest, admin: user.isAdmin, employee : user.isEmployee };更多推荐
自定义 Surf 平台根范围 API
发布评论