Patch will probably fail with my luck, but here's what it looks like:
Index: location.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/location.module,v
retrieving revision 1.222.2.20
diff -u -r1.222.2.20 location.module
--- location.module 3 Mar 2009 20:07:19 -0000 1.222.2.20
+++ location.module 13 Oct 2009 11:36:05 -0000
@@ -86,7 +86,7 @@
*/
function location_perm() {
return array(
- 'submit latitude/longitude',
+ 'submit latitude/longitude', 'view user list', 'view location list'
);
}
Index: location.views_default.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/location.views_default.inc,v
retrieving revision 1.5
diff -u -r1.5 location.views_default.inc
--- location.views_default.inc 22 Oct 2008 17:28:48 -0000 1.5
+++ location.views_default.inc 13 Oct 2009 11:39:52 -0000
@@ -169,6 +169,10 @@
'default' => '-1',
));
$handler = $view->new_display('page', 'Page', 'page_1');
+ $handler->override_option('access', array(
+ 'type' => 'perm',
+ 'perm' => 'view location list',
+ ));
$handler->override_option('path', 'location/views');
$handler->override_option('menu', array(
'type' => 'normal',
@@ -601,6 +605,10 @@
'default' => '-1',
));
$handler = $view->new_display('page', 'Page', 'page_1');
+ $handler->override_option('access', array(
+ 'type' => 'perm',
+ 'perm' => 'view user list',
+ ));
$handler->override_option('path', 'location/users');
$handler->override_option('menu', array(
'type' => 'normal',
Comments
Comment #1
jerdiggity commentedComment #2
yesct commentedtagging.
In case someone is looking at this, who has never reviewed a patch before:
http://drupal.org/patch/review
(And you dont have to do a complete review, even just doing a partial review is helpful. For example, just try and apply the patch and report back if it cleanly applies: http://drupal.org/patch/apply Or do a code style review. Or just apply it, and see if the permissions work, etc.)
Comment #3
hutch commentedI've tested this patch on current location module, April 6 2010
So it went in OK, a bit bumpy but patch is smart ;-)
Tested it and the perms work.
Ran Code review over the location module, plenty to do there but none of it related to this patch.
Attached is a re-roll of the patch using unix diff.
This is a good and sensible addition to this module.
Comment #4
yesct commentedI dont understand permissions and how they are controlled in code. Is it really this easy to add in new permissions?
Comment #5
hutch commentedYes.
see http://api.drupal.org/api/function/hook_perm/6
Views has its own way of managing permissions as you can see in the rest of the patch, elsewhere you would use something like:
The Menu system has its own system for managing access permissions, very powerful.
Comment #6
yesct commentedtagging
Comment #7
jerdiggity commentedYikes I must have been half-asleep when I originally submitted this issue. And then again two months later. ;)
(Changing title...)
Comment #8
hutch commentedJust a reminder to the maintainer to consider this patch, the one in#3 works fine on this morning's snapshot
Comment #9
rooby commentedCommitted to the D6 & D7 branches with a couple of minor changes:
* Naming of permissions
* Position of perms in default view array
* Also added perm for location directory view
Comment #10
yesct commentedhttp://drupal.org/cvs?commit=366560
and
http://drupal.org/cvs?commit=366566
:)
Comment #12
agileware commentedI must have been fully asleep when I committed this.
I think this should be rolled back because views permissions are not fixed.
Users can edit the permissions in their views and make it so these permissions don't do what they say they do.
Why not just assign permissions by role to the views yourself?
Might need to also add an update to make sure we keep peoples permissions if they are currently using these.
It just needs to check the roles that have these permissions and add them to the views permissions.
Comment #13
rooby commentedShit that was me on a different computer. Gotta check the login :(
Comment #14
jerdiggity commentedAll this patch was supposed to do was add two additional perms to location.module which could then be toggled/overridden as needed. If it's rolled back, hook_perm() in location.module will go back to consisting only of
so I'm not sure what the benefit would be if it were rolled back... Unless I'm missing something (wouldn't be the first time), in which case, ;-)
Am I missing something?
Comment #15
legolasboClosing old D6 issues as D6 is end of life