[development] Proposed user_access / $user->roles hook

Ron Parker sysop at scbbs.com
Thu Mar 29 18:47:08 UTC 2007


Gerhard Killesreiter wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Ron Parker schrieb:
>  
>
>>That, essentially, is the modification to user_access that I have
>>created so that my module would work.  Briefly, my OG User Roles module
>>is designed to assign role(s) to a user restricted to the OG group he is
>>in.  Details on it are here: http://drupal.org/node/87679.
>>    
>>
>
>IMO you are trying to use the role system for something it wasn't
>designed for: Dynamically asigned roles. Drupal roles are always static.
>
>  
>
Bingo!  I seek to propose a hook that would essentially allow the role 
system to become dynamic.

>>What else, besides user_access, does the default node/add mechanism call
>>for permissions checks?
>>    
>>
>
>Nothing. You probably need to rebuild the user's menu to get your
>changed permisions to "take".
>
>  
>
Since my modified user_access currently works for 
list/view/update/delete, the menu system works perfectly.  The correct 
create content links to add the correct node types for a role appear as 
they should.  The problem is when I click on  node/add/<node 
type>?gids[]=<group nid>, the user gets "access denied".  user_access 
returns the correct roles, but there is something else in the node/add 
process that causes this process to fail.  My guess right now is that 
$user->roles is called somewhere else in the process (outside of where 
it's called in user_access), and that's causing the failure. 

Problem is, I just can't locate where this is.

>Since rebuilding the menu is a costly operation (in Drupal5) I am not
>too excited about dynamically assigned roles.
>
>  
>
I understand, and appreciate your response.  OG dynamically rebuilds 
it's menu each time, so the overhead would be the same.  And, again, the 
OG menu uses my modified user_access to build the correct menu according 
to group role(s).

-- 
Ron Parker
Software Creations               http://www.scbbs.com
Self-Administration Web Site     http://saw.scbbs.com
SDSS Subscription Mgmt Service   http://sdss.scbbs.com
Central Ave Dance Ensemble       http://www.centralavedance.com
R & B Salsa                      http://www.randbsalsa.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070329/3a7bee0c/attachment.htm 


More information about the development mailing list