[dev] [patch] Permissions for Menus
Marko Djukic
marko at oblo.com
Sun May 4 06:02:12 PDT 2003
don't take my suggestions as authorative. it was the line of thinking i had a
couple of weeks and i was just stirring up a discussion now, there sure will be
other opinions on the list.
marko
ps. could you send patches in with "cvs diff -u"? thanks.
Quoting Joe Wilson <joe.wilson at mindcandy.org>:
> Quoting Marko Djukic <marko at oblo.com>:
>
> > why not just have the permission as "imp" or "mnemo"? then when we do get
> to
> > have permission inheritance it will be the root permission of whatever is
> > tagged on, "imp:somethingelse:andelse"...
>
> Agreed. However, since I am new to Horde, I didn't want to stomp on work
> that
> someone else was doing. I felt that isolating the permission was the safest
> course. Anyway, my immediate concern was with UI and not with application
> authorization.
>
> >
> > plus why name it "menu:imp" it should be more logical so that it is checked
> > even
> > if someone types "/imp" in the url which has nothing to do with menus.
>
> Again, I agree. Until I felt more comfortable with the framework code, I was
> hesitant to be that ambitious.
>
> I have reattached the patch to lib/Registry.php below with the change from
> "menu:" . $app -> $app. The patch to menu.php should not be effected. I
> will
> start working on extending this to application authorization in a
> standardized
> way over the next week or so.
>
> Index: Registry.php
> ===================================================================
> RCS file: /usr/local/cvs/horde/horde/lib/Registry.php,v
> retrieving revision 1.150
> diff -r1.150 Registry.php
> 179c179,180
> < if (in_array($params['status'], $filter)) {
> ---
> > $status = $this->getParam('status', $app);
> > if (in_array($status, $filter)) {
> 756a758,768
> >
> > if ($parameter == 'status' && $ret == 'perm') {
> > require_once HORDE_BASE . '/lib/Perms.php';
> > $perm = &Perms::singleton();
> > if ($perm->hasPermission($app, Auth::getAuth(), _PERMS_READ))
> {
> > $ret = 'active';
> > } else {
> > $ret = 'inactive';
> > }
> > }
> >
>
>
>
> >
> > marko
> >
> > Quoting Joe Wilson <joe.wilson at mindcandy.org>:
> >
> > > The following patch provides the ability to use the permissions subsystem
> > to
> > > control whether a given menu option is displayed in the main Horde
> > navigation
> > > menu. If the $app['status'] parameter is set to 'perm', the permission
> of
> > > the
> > > user is checked for 'menu:'.$app. If the user has read permission, the
> > menu
> > > item is listed as active, inactive otherwise. For example, to allow a
> user
> > > to
> > > access imp, you would create the permission "menu:imp" and give the user
> > read
> > > access.
> > >
> > > Joe
> > >
> > > Index: horde/menu.php
> > > ===================================================================
> > > RCS file: /usr/local/cvs/horde/horde/menu.php,v
> > > retrieving revision 2.38
> > > diff -r2.38 menu.php
> > > 21,23c21,24
> > > < foreach ($registry->applications as $app => $params) {
> > > < if (array_key_exists('menu_parent', $params)) {
> > > < $children[$params['menu_parent']][$app] = $params;
> > > ---
> > > > foreach ($registry->listApps(array('active', 'heading',
> 'notoolbar'))
> > > as
> > > $app) {
> > > > $menu_parent = $registry->getParam('menu_parent', $app);
> > > > if ($menu_parent) {
> > > > $children[$menu_parent][$app] =
> > $registry->applications[$app];
> > > 29,30c30,31
> > > < foreach ($registry->applications as $app => $params) {
> > > < $tmp[$app] = $params;
> > > ---
> > > > foreach ($registry->listApps(array('active', 'heading',
> 'notoolbar'))
> > > as
> > > $app) {
> > > > $tmp[$app] = $registry->applications[$app];
> > > 36c37
> > > < if ($cparams['status'] == 'active') {
> > > ---
> > > > if ($registry->getParam('status', $capp) == 'active') {
> > > 43c44,48
> > > < }
> > > ---
> > > > } else {
> > > > if ($registry->getParam('status', $app) == 'heading') {
> > > > unset($tmp[$app]);
> > > > }
> > > > }
> > > Index: horde/lib/Registry.php
> > > ===================================================================
> > > RCS file: /usr/local/cvs/horde/horde/lib/Registry.php,v
> > > retrieving revision 1.150
> > > diff -r1.150 Registry.php
> > > 179c179,180
> > > < if (in_array($params['status'], $filter)) {
> > > ---
> > > > $status = $this->getParam('status', $app);
> > > > if (in_array($status, $filter)) {
> > > 756a758,768
> > > >
> > > > if ($parameter == 'status' && $ret == 'perm') {
> > > > require_once HORDE_BASE . '/lib/Perms.php';
> > > > $perm = &Perms::singleton();
> > > > if ($perm->hasPermission("menu:" . $app, Auth::getAuth(),
> > > _PERMS_READ)) {
> > > > $ret = 'active';
> > > > } else {
> > > > $ret = 'inactive';
> > > > }
> > > > }
> > > >
> > >
> > >
> > >
> > > --
> > > Horde developers mailing list
> > > Frequently Asked Questions: http://horde.org/faq/
> > > To unsubscribe, mail: dev-unsubscribe at lists.horde.org
> > >
> >
> >
> >
> > --
> > Horde developers mailing list
> > Frequently Asked Questions: http://horde.org/faq/
> > To unsubscribe, mail: dev-unsubscribe at lists.horde.org
> >
>
>
More information about the dev
mailing list