[dev] new Applications Permissions code
Joel Vandal
jvandal at infoteck.qc.ca
Wed Oct 1 13:52:33 PDT 2003
Hi,
I've rewrite my patch for "Applications Permissions" and these change allow any user to add a permission for any application and if the user/group don't have access, then the application will not be visible on the menu.
How to test it... apply the following patch and add a permission for ex. gollem or kronolith ...
As suggested by chuck and other on IRC, I no more use an horde.apps category and all permissions are controlled using admin/perms.php
Now, I will check for the api.php to list permission that the application support.
A little explanation for why I also want App. Function and Preferences permissions system :
- some user will have access to create Shared Calendar, some not... (Preferences)
- some user will be able to "Fetchmail" other not... (Function/Preferences)
- ...
If these change are "approved", then I will continue my work and implement these options...
--
Joel Vandal
-------------- next part --------------
Index: Registry.php
===================================================================
RCS file: /repository/horde/lib/Registry.php,v
retrieving revision 1.167
diff -r1.167 Registry.php
141a142,145
> /* Make sure we've included the Perms library in case there are
> any Perms:: checks in registry.php. */
> require_once HORDE_BASE . '/lib/Perms.php';
>
619c623,630
< if ($app == $this->_currentApp) {
---
>
> // Application Permissions system.
> $perms = &Perms::singleton();
> if ($perms->exists($app) && (!$perms->hasPermission($app, Auth::GetAuth(), _PERMS_SHOW))) {
> return PEAR::raiseError(sprintf(_("Permission denied for %s/%s."), $app, Auth::GetAuth()));
> }
>
> if ($app == $this->_currentApp) {
Index: menu.php
===================================================================
RCS file: /repository/horde/menu.php,v
retrieving revision 2.44
diff -r2.44 menu.php
18c18
< global $registry;
---
> global $registry, $perms;
39a40,43
> if ($perms->exists($capp) &&
> !$perms->hasPermission($capp, Auth::GetAuth(), _PERMS_SHOW)) {
> $active = false;
> }
66a71,73
> require_once HORDE_BASE . '/lib/Perms.php';
> $perms = &Perms::singleton();
>
77a85,89
>
> if ($perms->exists($app) && !$perms->hasPermission($app, Auth::GetAuth(), _PERMS_SHOW)) {
> $params['status'] = 'inactive';
> }
>
Index: sidebar.php
===================================================================
RCS file: /repository/horde/util/sidebar.php,v
retrieving revision 1.3
diff -r1.3 sidebar.php
18c18
< global $registry;
---
> global $registry, $perms;
39a40,43
> if ($perms->exists($capp) &&
> !$perms->hasPermission($capp, Auth::GetAuth(), _PERMS_SHOW)) {
> $active = false;
> }
67a72,74
> require_once HORDE_BASE . '/lib/Perms.php';
> $perms = &Perms::singleton();
>
78a86,90
>
> if ($perms->exists($app) && !$perms->hasPermission($app, Auth::GetAuth(), _PERMS_SHOW)) {
> $params['status'] = 'inactive';
> }
>
More information about the dev
mailing list