Re: [development] remove or give priority to hook_node_grants
Was actually thinking about this the other day. I feel its a lil silly to have modules provide the priority for access control. I would really love to develop a drag and drop weight interface for the priority settings. Essentially, develop a node_access interface that assigns the priority for all node_access modules exposed currently. Wondering if theres any traction in that idea, and if so I can start hashing it out.
You no longer need to fiddle with priorities when overriding OG records - http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/og/modules/og_a... .
There is currently no hook for adjusting grants.
On Tue, Mar 31, 2009 at 7:26 AM, Llu?s <enboig@gmail.com> wrote:
I am developing a module to create "sub user types" inside OG. I have been able to modify hook_node_access_records using the "priority" so in certain cases I override OG access system.
Now I need to "override" the hook_node_grants so In certain cases a user who should be able to see certain nodes don't see them; how can I achieve this?
Thanks
-- *La vida ?s com una taronja, que esperes a exprimir-la? *Si creus que l'educaci? ?s cara, prova la ignor?ncia. *La vida ?s com una moneda, la pots gastar en el que vulguis per? nom?s una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
-- Scott Reynolds Cell: 630-254-2474 http://www.scottreynolds.us
I think this would be great; but it wouldn't solve my problem neither. How can I "remove" a realm from $grants[$realm] I tried to "overwrite" it, but it uses arrays and merge them, so it is impossible. On Tue, Mar 31, 2009 at 5:42 PM, Scott Reynolds <sdrreynolds@gmail.com> wrote:
Was actually thinking about this the other day. I feel its a lil silly to have modules provide the priority for access control. I would really love to develop a drag and drop weight interface for the priority settings. Essentially, develop a node_access interface that assigns the priority for all node_access modules exposed currently.
Wondering if theres any traction in that idea, and if so I can start hashing it out.
You no longer need to fiddle with priorities when overriding OG records - http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/og/modules/og_a....
There is currently no hook for adjusting grants.
On Tue, Mar 31, 2009 at 7:26 AM, Llu?s <enboig@gmail.com> wrote:
I am developing a module to create "sub user types" inside OG. I have been able to modify hook_node_access_records using the "priority" so in certain cases I override OG access system.
Now I need to "override" the hook_node_grants so In certain cases a user who should be able to see certain nodes don't see them; how can I achieve this?
Thanks
-- *La vida ?s com una taronja, que esperes a exprimir-la? *Si creus que l'educaci? ?s cara, prova la ignor?ncia. *La vida ?s com una moneda, la pots gastar en el que vulguis per? nom?s una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
-- Scott Reynolds Cell: 630-254-2474 http://www.scottreynolds.us
-- *La vida és com una taronja, que esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
Just add a drupal_alter() right after all the grants have been provided. yes, this requires a 1 line hack to core. On Tue, Mar 31, 2009 at 11:59 AM, Lluís <enboig@gmail.com> wrote:
I think this would be great; but it wouldn't solve my problem neither. How can I "remove" a realm from $grants[$realm]
I tried to "overwrite" it, but it uses arrays and merge them, so it is impossible.
On Tue, Mar 31, 2009 at 5:42 PM, Scott Reynolds <sdrreynolds@gmail.com> wrote:
Was actually thinking about this the other day. I feel its a lil silly to have modules provide the priority for access control. I would really love to develop a drag and drop weight interface for the priority settings. Essentially, develop a node_access interface that assigns the priority for all node_access modules exposed currently.
Wondering if theres any traction in that idea, and if so I can start hashing it out.
You no longer need to fiddle with priorities when overriding OG records - http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/og/modules/og_a....
There is currently no hook for adjusting grants.
On Tue, Mar 31, 2009 at 7:26 AM, Llu?s <enboig@gmail.com> wrote:
I am developing a module to create "sub user types" inside OG. I have been able to modify hook_node_access_records using the "priority" so in certain cases I override OG access system.
Now I need to "override" the hook_node_grants so In certain cases a user who should be able to see certain nodes don't see them; how can I achieve this?
Thanks
-- *La vida ?s com una taronja, que esperes a exprimir-la? *Si creus que l'educaci? ?s cara, prova la ignor?ncia. *La vida ?s com una moneda, la pots gastar en el que vulguis per? nom?s una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
-- Scott Reynolds Cell: 630-254-2474 http://www.scottreynolds.us
-- *La vida és com una taronja, que esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
Note that if you make a patch for Drupal 7 to add an alter there, it gets committed, and then you make a backport of it, God will only maim a kitten in response rather than killing one. Translation: Patch please, Lluis! That would be a great addition to Drupal 7. On Tuesday 31 March 2009 11:46:31 am Moshe Weitzman wrote:
Just add a drupal_alter() right after all the grants have been provided. yes, this requires a 1 line hack to core.
On Tue, Mar 31, 2009 at 11:59 AM, Lluís <enboig@gmail.com> wrote:
I think this would be great; but it wouldn't solve my problem neither. How can I "remove" a realm from $grants[$realm]
I tried to "overwrite" it, but it uses arrays and merge them, so it is impossible.
-- Larry Garfield larry@garfieldtech.com
Larry means "Please work on this existing patch"; http://drupal.org/node/309007 -- Ken On Tue, Mar 31, 2009 at 3:09 PM, Larry Garfield <larry@garfieldtech.com> wrote:
Note that if you make a patch for Drupal 7 to add an alter there, it gets committed, and then you make a backport of it, God will only maim a kitten in response rather than killing one.
Translation: Patch please, Lluis! That would be a great addition to Drupal 7.
On Tuesday 31 March 2009 11:46:31 am Moshe Weitzman wrote:
Just add a drupal_alter() right after all the grants have been provided. yes, this requires a 1 line hack to core.
On Tue, Mar 31, 2009 at 11:59 AM, Lluís <enboig@gmail.com> wrote:
I think this would be great; but it wouldn't solve my problem neither. How can I "remove" a realm from $grants[$realm]
I tried to "overwrite" it, but it uses arrays and merge them, so it is impossible.
-- Larry Garfield larry@garfieldtech.com
-- Ken Rickard agentrickard@gmail.com http://ken.therickards.com
I will check if the patch is useful to me. If it is, will it manage to drupal6? On Tue, Mar 31, 2009 at 10:20 PM, Ken Rickard <agentrickard@gmail.com> wrote:
Larry means "Please work on this existing patch";
-- Ken
On Tue, Mar 31, 2009 at 3:09 PM, Larry Garfield <larry@garfieldtech.com> wrote:
Note that if you make a patch for Drupal 7 to add an alter there, it gets committed, and then you make a backport of it, God will only maim a kitten in response rather than killing one.
Translation: Patch please, Lluis! That would be a great addition to Drupal 7.
On Tuesday 31 March 2009 11:46:31 am Moshe Weitzman wrote:
Just add a drupal_alter() right after all the grants have been provided. yes, this requires a 1 line hack to core.
On Tue, Mar 31, 2009 at 11:59 AM, Lluís <enboig@gmail.com> wrote:
I think this would be great; but it wouldn't solve my problem neither. How can I "remove" a realm from $grants[$realm]
I tried to "overwrite" it, but it uses arrays and merge them, so it is impossible.
-- Larry Garfield larry@garfieldtech.com
-- Ken Rickard agentrickard@gmail.com http://ken.therickards.com
-- *La vida és com una taronja, que esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
I have tested it (never played with drupal_alter before) and what I would need is a patch at node.module: function node_access_grants($op, $account = NULL) { if (!isset($account)) { $account = $GLOBALS['user']; } - return array_merge(array('all' => array(0)), module_invoke_all('node_grants', $account, $op)); + $grants = array_merge(array('all' => array(0)), module_invoke_all('node_grants', $account, $op)); + drupal_alter("node_grants",$grants); return $grants; } but it would also deny my access to the group node so I will have to look for another way to solve my problem. On Wed, Apr 1, 2009 at 1:22 AM, Lluís <enboig@gmail.com> wrote:
I will check if the patch is useful to me. If it is, will it manage to drupal6?
On Tue, Mar 31, 2009 at 10:20 PM, Ken Rickard <agentrickard@gmail.com> wrote:
Larry means "Please work on this existing patch";
-- Ken
On Tue, Mar 31, 2009 at 3:09 PM, Larry Garfield <larry@garfieldtech.com> wrote:
Note that if you make a patch for Drupal 7 to add an alter there, it gets committed, and then you make a backport of it, God will only maim a kitten in response rather than killing one.
Translation: Patch please, Lluis! That would be a great addition to Drupal 7.
On Tuesday 31 March 2009 11:46:31 am Moshe Weitzman wrote:
Just add a drupal_alter() right after all the grants have been provided. yes, this requires a 1 line hack to core.
On Tue, Mar 31, 2009 at 11:59 AM, Lluís <enboig@gmail.com> wrote:
I think this would be great; but it wouldn't solve my problem neither. How can I "remove" a realm from $grants[$realm]
I tried to "overwrite" it, but it uses arrays and merge them, so it is impossible.
-- Larry Garfield larry@garfieldtech.com
-- Ken Rickard agentrickard@gmail.com http://ken.therickards.com
-- *La vida és com una taronja, que esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
-- *La vida és com una taronja, que esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
Sorry, that was the wrong issue. We have not filed the node grants issue yet because of changes to the database layer. See http://groups.drupal.org/node/14419 -- Ken On Wed, Apr 1, 2009 at 5:08 AM, Lluís <enboig@gmail.com> wrote:
I have tested it (never played with drupal_alter before) and what I would need is a patch at node.module:
function node_access_grants($op, $account = NULL) {
if (!isset($account)) { $account = $GLOBALS['user']; }
- return array_merge(array('all' => array(0)), module_invoke_all('node_grants', $account, $op)); + $grants = array_merge(array('all' => array(0)), module_invoke_all('node_grants', $account, $op)); + drupal_alter("node_grants",$grants); return $grants; }
but it would also deny my access to the group node so I will have to look for another way to solve my problem.
On Wed, Apr 1, 2009 at 1:22 AM, Lluís <enboig@gmail.com> wrote:
I will check if the patch is useful to me. If it is, will it manage to drupal6?
On Tue, Mar 31, 2009 at 10:20 PM, Ken Rickard <agentrickard@gmail.com> wrote:
Larry means "Please work on this existing patch";
-- Ken
On Tue, Mar 31, 2009 at 3:09 PM, Larry Garfield <larry@garfieldtech.com> wrote:
Note that if you make a patch for Drupal 7 to add an alter there, it gets committed, and then you make a backport of it, God will only maim a kitten in response rather than killing one.
Translation: Patch please, Lluis! That would be a great addition to Drupal 7.
On Tuesday 31 March 2009 11:46:31 am Moshe Weitzman wrote:
Just add a drupal_alter() right after all the grants have been provided. yes, this requires a 1 line hack to core.
On Tue, Mar 31, 2009 at 11:59 AM, Lluís <enboig@gmail.com> wrote:
I think this would be great; but it wouldn't solve my problem neither. How can I "remove" a realm from $grants[$realm]
I tried to "overwrite" it, but it uses arrays and merge them, so it is impossible.
-- Larry Garfield larry@garfieldtech.com
-- Ken Rickard agentrickard@gmail.com http://ken.therickards.com
-- *La vida és com una taronja, que esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
-- *La vida és com una taronja, que esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
-- Ken Rickard agentrickard@gmail.com http://ken.therickards.com
participants (5)
-
Ken Rickard -
Larry Garfield -
Lluís -
Moshe Weitzman -
Scott Reynolds