The attached (huge) patch would add the anonymous role to the optionsList for user.roles.
I can imagine that this was left out because it would seem weird when creating a user – but when e.g. presenting a view of entities, or search facets on user roles (not that I would do such a thing), it's a bit annoying that the anonymous user has a "1" displayed instead of a role name.

Comments

fago’s picture

Status: Active » Needs work

Makes sense. However then we should add a validation handler to ensure we don't allow granting the anonymous user role to a user (when writing roles back).

mitchell’s picture

Title: Include "anonymous user" role in user role list » Include "anonymous" and "authenticated" in user roles list
Component: Metadata integration » Core integration

#1325834: Rules action: Send mail to all users of a role, authenticated missing from list is a request for a way to email all authenticated users, which is currently unavailable because Entity API unsets authenticated and anonymous.

mitchell’s picture

Here's a fairly comprehensive list of files in contrib that call entity_metadata_user_roles:

  • mimemail/mimemail.module
  • privatemsg/privatemsg_rules/privatemsg_rules.rules.inc
  • rules/modules/system.rules.inc
  • rules/modules/user.rules.inc
  • ubercart/uc_store/includes/ca.inc
  • 1635740/rules_mail_edit.rules.inc
mitchell’s picture

Status: Needs work » Needs review
StatusFileSize
new615 bytes

#1 is already done in af60182 with the 'edit' $op.

This patch unsets 'edit' as the default $op to help solve the use case mentioned in #2, however the 'anonymous' role is also included in 'mail_to_users_of_role'. Would this be solved with a 'view' op that only unsets 'anonymous'?

elBradford’s picture

Any updates on this issue? Issue #1325834: Rules action: Send mail to all users of a role, authenticated missing from list is depending on this patch.

fonant’s picture

Patch in #4 works fine for me to allow the "authenticated user" role to appear, and seems to make sense. Not sure about also including "anonymous user" - useful for some situations, but not all?

thomas1977’s picture

Issue summary: View changes

Is this working yet?

ifrik’s picture

The patch in #4 works for me - and is really helpful for me.

chris matthews’s picture

The 6 year old patch in #4 to callbacks.inc applied cleanly to the latest entity 7.x-1.x-dev and (if still relevant) may need additional reviews before RTBC.