添加alfresco ui操作仅由管理员可见

时间:2014-07-27 17:16:05

标签: xml alfresco uiactionsheet user-permissions

我尝试向露天添加UI动作,并使用此代码:

<action id="CreateDoc">

    <permissions>
        <!-- each permission can be an Allow or Deny check -->
        <permission allow="true">Write</permission>

    </permissions>
    <label-id>CreateDoc</label-id>
    <image>/someco/images/icons/stoplight-disable.png</image>
    <action-listener>#{WebSettingsBean.createDoc}</action-listener>

</action>

<action-group id="document_browse">
    <action idref="CreateDoc" />
</action-group>

<action-group id="document_browse_menu">
    <action idref="CreateDoc" />

</action-group>
<action-group id="doc_details_actions">
    <action idref="CreateDoc" />
</action-group>

现在的问题是,我希望所有拥有&#34;写&#34;的权限的用户都无法看到该操作。我希望它只能由管理员看到。那可能吗?如何更改权限部分?

1 个答案:

答案 0 :(得分:1)

您可以在权限标记中设置文件permissionDefinitions.xml中定义的任何权限或角色。该文件包含在alfresco.war中。有一个名为Coordinator的角色,它具有与管理员几乎相同的权限。还有一个名为Administrator的角色,但它似乎已被弃用。

您还可以使用标记求值程序并编写扩展类org.alfresco.web.action.evaluator.BaseActionEvaluator的自己的求值程序。这样,您可以执行多个评估,例如,检查用户是否在admin用户组中。

您可以在web-client-config-actions.xml文件中看到一些使用示例,其中还包含操作定义的完整示例

<!-- full example -->
<action id="example1_edit_doc_http">

    <!-- a list of permissions to evaluate action against before checking other preconditions -->
    <permissions>
        <!-- each permission can be an Allow or Deny check -->
        <permission allow="true">Write</permission>
        <permission allow="false">AddChildren</permission>
    </permissions>

    <!-- the evaluator is a class implementing the org.alfresco.web.action.ActionEvaluator contract,
         it will be executed passing in the context for the outer action component -->
    <evaluator>org.alfresco.web.action.evaluator.EditDocHttpEvaluator</evaluator>

    <!-- label and tooltip can be provided as text or preferable I18N message Id -->
    <label>Edit</label>
    <label-id>edit</label-id>
    <tooltip>My Tooltip</tooltip>
    <tooltip-id>tooltip</tooltip-id>

    <!-- various presentation attributes - generally it is better to provide these as part of the
         parent 'actions' definition to give a consistent look-and-feel to a group of actions -->
    <show-link>false</show-link>
    <style>padding:4px</style>
    <style-class>inlineAction</style-class>
    <image>/images/icons/edit_icon.gif</image>

    <!-- action, action-listener, onclick, href and target action attributes are supported -->
    <action-listener>#{CheckinCheckoutDialog.editFile}</action-listener>
    <action>editDocument</action>
    <href>http://...</href>
    <target>new</target>
    <onclick>javascript:myhandler</onclick>

    <!-- script attribute for specifying a javascript file to execute - by Path or NodeRef -->
    <script>/Company Home/Data Dictionary/Scripts/myjavascript.js</script>

    <!-- params specify the <f:param> tags to be generated as children of the action component -->
    <!-- accessable by an ActionEvent handler or passed directly as href/script URL arguments -->
    <params>
        <param name="id">#{actionContext.id}</param>
    </params>

</action>