I have a content type which I only want to be able to be created from within a group, and which only group members with a certain role can create as well. No one except for this special group role is able to create or edit this node type.

Now I've got a user who is subscribed to a group and has this special role at the group level, but does not have any create access for this node type.

I don't have Content Access or TAC, but I do have Relativity and Wikitools acting on this node type, which obviously complicates things. I've checked and double checked the settings for those modules, though, and there's nothing that should be interfering with creation of this node type. I put some print statements into the code (for Relativity), and when it calls "node_access('create', $nodetype)", it returns false. OG User Roles isn't hooking into this and giving the per-group rights to this user.

Additionally, a link to create this node type should also come up in the Group Details block in the sidebar, but it does not for this user (it does for the admin).

I'm running Drupal 5.1, the latest dev version of OG, and OG User Roles 2.1.

Comments

somebodysysop’s picture

Does this affect you at all: http://drupal.org/node/166253

If not, what is the output of your og_user_test table for the URLs in question?

devin.gardner’s picture

As expected, the user has the permissions necessary at all of these group pages.

In og_user_roles.module, I noticed in the function "og_user_roles_og_access_check()" it begins with "if ($op != 'create' && $node->nid && $node->status) {". Is that function related to getting create access for a node type?

devin.gardner’s picture

Status: Active » Fixed

OK, I spent some more time reading around and then remembered I've also got Buddylist enabled here. So I set OG User Roles module weight to -1 and that fixed the problem! I would never have guessed Buddylist could have been interfering in this.

I guess you need some kind of init code to ensure no matter what that OG User Roles is always weighted higher than Buddylist if it's installed.

somebodysysop’s picture

I guess you need some kind of init code to ensure no matter what that OG User Roles is always weighted higher than Buddylist if it's installed.

Any suggestions?

rconstantine’s picture

@SomebodySysop - It is pretty simple to set your module's weight at install. I've done it in one or two of my own modules, though I don't recall which at the moment.

Anyway, I think there may be some bootstrapping that must be done before you can use the module_exists function to check for the presence of buddylist. However, you could just give your module a -1 weight no matter the case. It is just a SQL query to change that in the database (system table?). Of course, the row containing you module must be in there first, so I don't recall whether that can be done in hook_install, or if there was another hook that needed to be used.

somebodysysop’s picture

I use the ModuleWeight module to adjust module weights: http://www.drupal.org/project/moduleweight.

However, beyond the Buddylist issue, I am finding issues where a module executes user_access with cached permissions so that the OG User Roles role adjustment never loads. This sometimes requires more than a module weight adjustment. It requires that OG User Roles sets the $user object roles first. Right now, this is done using hook_user('load") and hook_init(). Yet, there are still cases where users are getting "access denied" for content they should have group permission (og roles) to see. This is an example: http://drupal.org/node/167180

So, I am soliciting ideas as to how I might assure that og user roles always gets to set the roles first.

Anonymous’s picture

Status: Fixed » Closed (fixed)