自定义 Surf 平台根范围 API

编程入门 行业动态 更新时间:2024-10-27 08:27:20
本文介绍了自定义 Surf 平台根范围 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想自定义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>

  • 我该如何实施?
  • Alfresco Root Scoped Objects 是否可以用作 Surf Platform Root Scoped 对象?
  • 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/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

    本文发布于:2023-10-05 09:35:15,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1467349.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:自定义   平台   Surf   API

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!