This is a follow up for #220119: Permission to "approve other suggestions only" to make it actually deploy-able on groups based setups like localize.d.o. While separate permissions are now available, groups still lump the self-approval and community approval permissions together. Our l10n_groups module allows for two permission levels in groups: members and admins. We need to migrate this to allowing arbitrary levels.

Tasks at hand are:

- remove permission handling code from l10n_groups (done)
- add dependency on og_user_roles (done)
- check whether 6.x.-4.x of og_user_roles is available (@todo)
- remove team member and admin permissions from users by default (we are going to grant not revoke these on groups) (done)
- add three new roles: team member, self-moderator and community moderator (done)
- add permissions to these items (done)
- grant the roles to users depending on their existing group membership (done)
- add code to set up og_user_roles for correct future use (@todo)
- verify that group context is set on all l10n_community pages, so we get the right roles for people (@todo)

Comments

gábor hojtsy’s picture

StatusFileSize
new8.6 KB

Verifying context settings turned out that deployment of this is blocked by og_user_roles having no support for extended contexts. See #613530: Not respecting extended group context for discussion and suggested patch.

Also attached updated patch which implements og_user_roles setting as well.

hass’s picture

+

gábor hojtsy’s picture

StatusFileSize
new28.75 KB

Ok, now that we have #613530: Not respecting extended group context committed, I've tested our code with that. Looks like we have a bug on our own in that we cache user permissions and then do not get notified of user_access() cache clearing. Since there is no such notification available, we should really just rely on user_access() instead of trying to implement a caching layer on top of that. So I worked to remove our caching layer (custom internal permissions system), and rely on user_access instead. This makes the og_user_roles integration work nicely.

I've run the test system with this, and it all passed (although it does not have too granular testing for permissions, it does check for some permission things).

I've added a @todo though for the remote submitter, since in that case, the OG context is not set, and OGUR will not kick in to grant the required permissions, so that will not work yet. I need to revisit that before this is viable, so the remote submission code works as nicely as the others.

Reviews are welcome as always!

gábor hojtsy’s picture

Status: Needs work » Needs review
StatusFileSize
new30.69 KB

Here is an update which hopefully resolves the remaining @todo. I've abstracted group setting in l10n_groups and added code to invoke that from l10n_remote to set a group context properly even in XML-RPC calls. That allows us to use the same permission models/mechanisms in that case too.

Now onto upgrade path testing and testing that this latest fix is right.

gábor hojtsy’s picture

StatusFileSize
new35.85 KB

In testing, the update turned out to have a bug in removing existing permissions. Also, I've removed code and schema around the 'model' column in l10n_groups, since we do not use that for anything (og_user_roles handles all permissions) and added code to set the l10n_groups weight to before og_user_roles.

Doing more testing.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new36.1 KB

Ok, here is a well tested patch which also adds a user role for community managers (those who can hand out all these fine permissions). Existing group admins will get that role as well.

Also found and fixed a bug with l10n_remote module not accepting remote submissions properly.

I think this is as far as we can get here. Unfortunately og_user_roles will only grant one role per "workflow action", and the given role is not configurable on a per-group basis. Eg. some groups would want to grant all self-moderation, community moderation and community manager roles to all group admins for example, some groups will be more restrictive. I believe there should be a generic solution outside of l10n_server for this, it is not the job of our module to do this automation, since it is quite generic. In the interest of pushing this out as early as possible, I'll not postpone this issue on that automation but will get group maintainers to do the manual work of assigning roles when they need to do that.

I think this is good enough to be committed, but do not have the time now to do the full deployment, so just posting here and plan to come back to here soon to commit and do the deployment on localize.drupal.org.

gábor hojtsy’s picture

BTW patch passes the existing automated tests (which admittedly do not cover lots of the permissions subtleties). It was also human-tested in various scenarios including remote string submission, users who are group admins but otherwise not admins and group members across different groups. I think this is as much as I could test this change, and I'm hopefully it will be fine deployed :)

hass’s picture

Is it intentionally that you don't drop the 'model' column in l10n_groups.install?

gábor hojtsy’s picture

@hass: there is code to do that, look at db_drop_field($ret, 'l10n_groups_group', 'model');

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Committed and deployed on Drupal.org!

gábor hojtsy’s picture

StatusFileSize
new5.06 KB

Ha, I was jumping to review and possibly advance #652460: Add permission to allow declining own translations but then realized that this change actually does not hand out group roles to people when the AJAX suggestion handling is done, so approval and decline actions via those AJAX callbacks was not possible. Also noted an issue with the string listing copy buttons in the output, which I'm also fixing here. Committing and deploying.

gábor hojtsy’s picture

StatusFileSize
new1.87 KB

And updates to the tests. Now tests pass again.

gábor hojtsy’s picture

News post of localize.drupal.org deployment at http://localize.drupal.org/node/616

Status: Fixed » Closed (fixed)

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