So when a user turns on a new activity access control module, they won't have the benefits of that access control module. This is because the activity_access table has no knowledge of that module for all the past activities. All new activities will be applied to that access control.

So like node_access, we need to an activity_rebuild_access() which is a batch process.

Comments

Scott Reynolds’s picture

steps to implement
1.) form_alter system_modules add in submit function
2.) submit function compares the variable_get('number_activity_modules') against the count(module_implements('access_Grants'))
3.) if they differ set a variable that says "You need to rebuild your access" and it bugs admins via drupal_set_message() in hook_init(). It also sets the 'number_activity_modules' to the new value.

In no rush to implement this but figured I would spell it out, which probably is the hardest part.

Bilmar’s picture

subscribing

Scott Reynolds’s picture

So the issue here is that the hook_activity_grants() has three parameters now. Two of which can become one: $activity_record and $type. ($activity_record->type == $type).

The third one is the $object. Problem is we have no way to grab the existing object. So what do we think? Can we get away with changing this API?

Modules that I know about.
1.) Flag Friend
2.) user relationships
3.) flag
4.) fbss

Those are the modules that I know about that implement the Access api.

Scott Reynolds’s picture

Status: Active » Needs review
StatusFileSize
new7.5 KB

Assuming we are cool with that API change (I say yes.), here is the patch.

It contains cleanups to how we get grants, and a cool trick I learned to make system_settings_form_submit to use array_keys(array_filter()) for checkboxes.

http://img.skitch.com/20091208-t4ji13n78yysukxybw6aghupss.jpg

Scott Reynolds’s picture

StatusFileSize
new8.47 KB

I have 6 modules that provide realms, some of them are custom, but the contrib ones are
1.) flag
2.) flag friend
3.) votingapi
4.) comment (via comment.activity.inc in Activity module)

Each module (both contrib and custom) can easily use just the activity record for their grants.

And the activity_access table has over 12 thousand rows. It all rebuilt correctly.

As an advanced use case, I would say that the API change isn't a big deal.

Here is a re-roll with a small change to DEVELOPERS.txt for the api change.

I think this is a good idea.

Scott Reynolds’s picture

Scott Reynolds’s picture

Ok we have a way through that one issue. Sirkitree what do you think API change ok with you? I am cool with it but I want your input before I commit it.

sirkitree’s picture

Yes I'm cool - it's minor and not a lot of ppl integrate rly - Only one I rly know about is FBSS in contrib - maybe we let them know.

Scott Reynolds’s picture

Status: Needs review » Fixed

And in it goes http://drupal.org/cvs?commit=299838.

I will follow up with patches to flag friend, fbss. And add comments / new patches for Votingapi, and User Relationships.

Ironically, Flag is just fine, apparently I didn't add all three variables to the hook definition for that...oops...

Status: Fixed » Closed (fixed)
Issue tags: -activity2alpha

Automatically closed -- issue fixed for 2 weeks with no activity.