如何将访问控制应用于我的Joomla 2.5组件的部分首选项?

时间:2023-02-09 10:58:21

I am creating a MVC component in Joomla 2.5. I am using access control to restrict access to different backend views of this component. Each of these views have some option fields in the component's preferences (config.xml).

我正在Joomla 2.5中创建一个MVC组件。我正在使用访问控制来限制对此组件的不同后端视图的访问。这些视图中的每一个都在组件的首选项(config.xml)中有一些选项字段。

I know how to apply access control to restrict access to the preferences as a whole, but I am wondering if there is a possibility to apply different access control restrictions to some of the fields within the preferences.

我知道如何应用访问控制来限制对首选项的访问,但我想知道是否有可能对首选项中的某些字段应用不同的访问控制限制。

1 个解决方案

#1


0  

If you're talking about the Preferences you add to your main view using:

如果您正在讨论使用以下内容添加到主视图的首选项:

JToolBarHelper::preferences('com_mycomponent', $height, $width, $alt, $path, $onClose);

Then no, there is nothing in the checks the access of a given field in com_config's default view (/administrator/components/com_config/views/component/tmpl/default.php)

然后不,检查中没有任何内容在com_config的默认视图中访问给定字段(/administrator/components/com_config/views/component/tmpl/default.php)

One possible solution would be to only present the real Preferences button to Super Users or those with equivalent permissions and then create a customised version for all other users that only presents the fields from the form they have permission to use.

一种可能的解决方案是仅向超级用户或具有同等权限的用户提供真实的“首选项”按钮,然后为仅显示他们有权使用的表单中的字段的所有其他用户创建自定义版本。

Of course this means you'll have to manage those additional meta-permissions yourself.

当然,这意味着您必须自己管理这些额外的元权限。

#1


0  

If you're talking about the Preferences you add to your main view using:

如果您正在讨论使用以下内容添加到主视图的首选项:

JToolBarHelper::preferences('com_mycomponent', $height, $width, $alt, $path, $onClose);

Then no, there is nothing in the checks the access of a given field in com_config's default view (/administrator/components/com_config/views/component/tmpl/default.php)

然后不,检查中没有任何内容在com_config的默认视图中访问给定字段(/administrator/components/com_config/views/component/tmpl/default.php)

One possible solution would be to only present the real Preferences button to Super Users or those with equivalent permissions and then create a customised version for all other users that only presents the fields from the form they have permission to use.

一种可能的解决方案是仅向超级用户或具有同等权限的用户提供真实的“首选项”按钮,然后为仅显示他们有权使用的表单中的字段的所有其他用户创建自定义版本。

Of course this means you'll have to manage those additional meta-permissions yourself.

当然,这意味着您必须自己管理这些额外的元权限。