Hi,

I think there is an issue in flag.inc in the function user_access at

return !empty($matched_roles) || empty($this->roles) || $account->uid == 1;

empty($this->roles) means if no roles are specified then any user can flag the content which is wrong, the correct behavior should if no roles are specified then no user can flag the content.

CommentFileSizeAuthor
#3 flag-832198-3.patch632 bytestim.plunkett

Comments

Soldierka’s picture

Hi,

I agree that there is something wrong with access rules. I've got a flag on my page that shouldn't be edit by anyone except me. I didn't check "authentical user" in "Roles that may use this flag", still every authentical user has access to this flag.

What can be wrong?

Thanks in advance.

quicksketch’s picture

Looks like a necessary change to me. I think we were supposed to fix this in #521804: Make 'Roles that may use this flag' not required., but only the 2.x version actually got fixed.

tim.plunkett’s picture

Status: Active » Needs review
StatusFileSize
new632 bytes

s/array_keys/array_values

The keys are just indexes, what we're looking for are the values.

tim.plunkett’s picture

Oh, I think I patched against 6.x-2.x, but the issue is applicable to both.

mooffie’s picture

s/array_keys/array_values
The keys are just indexes, what we're looking for are the values.

You're most probably wrong. It's the *keys* (of $account->roles) that hold the meaningful numeric IDs. The *values* are the string names of the roles and are useless for us.

mooffie’s picture

I think we were supposed to fix this in #521804: Make 'Roles that may use this flag' not required., but only the 2.x version actually got fixed.

Yes, it looks so.

I've committed this to 1.x as well.
http://drupal.org/cvs?commit=489744

But we're going to have a problem now: users will complain that their flag links no longer appear. Really, I don't understand why this wasn't documented in the UI. Uuuuff. I'll handle this now.

mooffie’s picture

I've reverted the patch.
http://drupal.org/cvs?commit=489752

Because this might hamper us in our efforts to implement #471212: No content types checked: allow all.

quicksketch’s picture

Status: Needs review » Closed (works as designed)

I think mooffie is correct in #5. If so, is there anything left to fix here?

I'll close this issue out for the time being, let's try to get 2.x out (for real this time), and these 1.x issues won't make a difference anyway.