Hey Eugen,

after trying the revisions/module_grants combo for a couple of months I did encounter several problems and was looking forward to the stable version of your module. Yet, after installing the module and setting up some content types for moderation I run into the problem of ot being able to assign permissions.

When I try to edit/set permissions I always get the error message "An illegal choice has been detected. Please contact the site administrator." even though I am logged in as the super user. It doesn't matter what role I am working on or wether I am setting a single permission or all. Is there something I am missing?

[I actually don't want to end up like Zylek: http://drupal.org/node/725072 though modr8 would be my next candidate.]

Best,
Paul

Comments

EugenMayer’s picture

Hi,

well Zylek is simply posting his issue on the wrong place..no wonder he wont get help :)
I will install content_moderation on a clean 6.16 ( though i did it before) and try it.

Please provide a step by step description on how to reproduce that error.

modr8:
Its quiet different. Does not have any history, does not have any workflow you can change, does not have granual permissions. But well, its still up to you.

broon’s picture

I found the problem. It's actually something I already experienced with revisioning: Drupal permission names are not allowed to contain special chars. And although some of them do work the single quote is an absolute no-go since permissions are set by something like:

$ret[] = update_sql("UPDATE {permission} SET perm = '$permission' WHERE rid = $role->rid");

So the line in content_moderation.module has to be changed (function content_moderation_perm(), delete the single quotes):

$rigths[] = "content moderation $type state $from_state to $to_state";

Now, I am able to save permission a do some more testing. ;)

Best,
Paul

EugenMayer’s picture

Hmm, sounds interesting. Are you using postgresql?

EugenMayer’s picture

Status: Active » Fixed

Well in the end, thats pretty bad by our DB abstraction in DB6...those values must be exaceped before stuffed into that sql query.

in addition

$ret[] = update_sql("UPDATE {permission} SET perm = '$renamed_permission' WHERE rid = $role->rid");

is realy bad style. (drupal_write_record or db_query with placehoders...)

Anyway applied your changes. This one is pretty bad as i will have to release a patch release which WILL brake the current permission system (or better, everybody will need to reassign permissions).

I was into huge hury when releasing that stable .. that pays off now. Pretty bad done by me.

Thanks for your help.

broon’s picture

Status: Fixed » Active

No, I'm using MySQL 5 and I do remember I had this problem more than once, it just didn't hit me when I first saw the error message (since it may have several causes). See this comment where it states

Again as already said above - permissions are not allowed to have special chars like single quotes and other non english characters. [a-zA-Z0-9] is allowed!

which is too strict as spaces and underscores are definitely fine to use.

Best,
Paul

broon’s picture

Status: Active » Fixed

Accidently set to active while we were both commenting.

EugenMayer’s picture

fixed and released in 1.1

EugenMayer’s picture

Status: Fixed » Closed (fixed)