自定义Surf Platform根范围API [英] Customizing Surf Platform Root-Scoped API
问题描述
我想自定义 Surf平台根范围内的API ,专门用于 user 对象。这意味着向用户对象添加新属性或方法,以检查用户是否位于 header.inc.ftl
[共享]中的特定组中,例如`< #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>
- 我该如何实现?
- 是 Alfresco根范围对象可以用作Surf Platform根范围对象?
- How can I implement this?
- Is Alfresco Root Scoped Objects can be used as Surf Platform Root-Scoped object?
我不知道自定义冲浪平台根对象。有人可以帮我吗?
I have no idea of customizing surf platform root object. Can anyone help me???
推荐答案
不确定您要完成的工作,但是角色安全性模型已硬编码在其中春季冲浪/春季网页脚本。有来宾,用户和管理员。如果您想要的是另一个类似的角色,则必须破解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>
在导航上。
只需检查一下用户是否在某个网页脚本中的某个组中是一个完全不同的故事,并且不提供相同的功能。
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}
miss
并通过响应进行工作。
miss and works through the response.
更新: 需要对项目权限属性进行一些调整。
在 header.get.js
中,将新角色传播到在 header.inc.ftl $ c $中得到正确处理的角色c>:
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 Platform根范围API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!