cancel
Showing results for 
Search instead for 
Did you mean: 

How to add all users to group EMAIL_CONTRIBUTORS?

mpeters
Champ in-the-making
Champ in-the-making
Hi,

what would be the easiest way to add all Alfresco users to the group EMAIL_CONTRIBUTORS (or any other group)? Unfortunately it is not possible to add the group EVERYONE to another group like EMAIL_CONTRIBUTORS (or did I overlooked the obvious solution)? Certainly one could add  user by user to the targeted group, but doing this with a few hundred (dayly changing) users is quite annoying Smiley Surprised.

Any hints, please?

Kind regards
Markus
23 REPLIES 23

piski
Champ on-the-rise
Champ on-the-rise
Hi everybody,

I have the same issue … on Alfresco 3.4.b Community.

I try to add the group EVERYONE to EMAIL_CONTRIBUTORS but the group EVERYONE doesn't appear in the search facility.

It doesn't work neither Share nor Explorer :
a) In Share -> Admin -> Groups -> Browse -> EMAIL_CONTRIBUTORS
I have 3 options :
- New subgroup (If I create the group "EVERYONE", I get
Échec de la création du groupe '02230003 Wrapped Exception (with status template): 02230382 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/repository/groups/children.post.js': 02230381 Authorities of the type EVERYONE may not be added to other authorities'.
- Add group (the choice "EVERYONE" does not appear)
- Add user (unusable for this case)

b) In Explorer -> Admin -> Groups -> Show All
I have 3 options (not the same as Share) :
- New subgroup (If I create the group "EVERYONE", I get the same error as Share)
- Add user
- Delete group

I think it should be "normal" to have the ability to put "EVERYBODY" in a group, an easy way to admin Alfresco rather than write scripts …

Can you confirm this behavior ?

Thanks.

mrogers
Star Contributor
Star Contributor
This should have been fixed.   I've asked QA to re-validate the issue and find out what happened.

mpeters
Champ in-the-making
Champ in-the-making
Hi everybody,

I have the same issue … on Alfresco 3.4.b Community.
[…]
Can you confirm this behavior ?

Yes, this is the behaviour we experienced as well.

Kind regards,
Markus

mpeters
Champ in-the-making
Champ in-the-making
Well, I tried to implement the solution I proposed in http://forums.alfresco.com/en/viewtopic.php?f=7&t=37704#p110745, but unfortunately it does not work.

I made a script in Repository>Data Dictionary>Scripts and tied it to a rule in User Homes. I can confirm, that the script will be executed when a new space is created within User Homes.

Here is the script:

// define the names of source and target group
var nameSourcegroup = 'EVERYONE';
var nameTargetgroup = 'ALLUSERS';

// get the source group *PROBLEM HERE*
var groupSource = people.getGroup('GROUP_' + nameSourcegroup);

if (groupSource) {
   // get the members of the source group
   var membersSourcegroup = people.getMembers(groupSource);

   if (membersSourcegroup) {
      // get the target group
      var groupTarget = people.getGroup('GROUP_' + nameTargetgroup);

      // if not existent, create the target group
      if (!groupTarget) {
         groupTarget = people.createGroup(nameTargetgroup);
      };

      if (groupTarget) {
         // loop over all members of the source group and add them to the target group
         for(var i = 0; i < membersSourcegroup.length; i++) {
            people.addAuthority(groupTarget, membersSourcegroup[i]);
         };
      };
   };
};

I guess, the code is easy understandable. It should copy all members of the group EVERYONE to the group ALLUSERS. As you can see the group ID needs to be prefixed by 'GROUP_' when called in people.getGroup() (didn't found this documented btw).

The problem is to get the source group for group EVERYONE (see comment *PROBLEM HERE*). The code works well with an ordinary group (i.e. created by me in Alfresco Share) as the source, but will fail with group EVERYONE as the source (either with or without prefix 'GROUP_'). The return value of people.getGroup() is null for group EVERYONE.

It seems, that Alfresco treats EVERYONE different than other groups.

Did someone find a solution for this issue?

Kind regards,
Markus

mrogers
Star Contributor
Star Contributor
Yes indeed.   EVERYONE is not a group.   Its a different type of authority.

I think it would be far easier just to add EVERYONE to EMAIL_CONTRIBUTORS.    There's clearly currently a bug on the UIs however the underlying services will work fine.

mpeters
Champ in-the-making
Champ in-the-making
I think it would be far easier just to add EVERYONE to EMAIL_CONTRIBUTORS.
That's just, what I want to do! But I cannot find a way  even avoiding the UI.

Can you provide information, if and when the bug will be fixed?

Thanks,
Markus

mpeters
Champ in-the-making
Champ in-the-making
Ok, while it's not possible to catch group EVERYONE with the people.getGroup() statement my next approach is to get all users by a lucene search. Here is the script I wrote:

// define the names target group
var nameTargetgroup = 'ALLUSERS';


// get the members of the source group
// var foundUsers = search.luceneSearch("QNAME:\"usr:user\"");
var foundUsers = search.luceneSearch("user://alfrescoUserStore", "QNAME:\"usr:user\"");

if (foundUsers.length) {
   // get the target group
   var groupTarget = people.getGroup('GROUP_' + nameTargetgroup);

   // if not existent, create the target group
   if (!groupTarget) {
      groupTarget = people.createGroup(nameTargetgroup);
   };

   if (groupTarget) {
      // loop over all found users from the lucene search and add them to the target group
      for(var i = 0; i < foundUsers.length; i++) {
         people.addAuthority(groupTarget, foundUsers[i]);
      };
   };
};

As you can see I used the two parameter version of search.luceneSearch(), because without specifying the store (here: user://alfrescoUserStore) I didn't get any results from search.luceneSearch().

Executing the search query in the node browser of Alfresco returns six entries (i.e. six users). Executing the search query in the script above returns also six users.

The code does not work, because:

1. The users found by the lucene search won't be added to the target group. In the log file I found the error "Authorities of the type WILDCARD may not be added to other authorities". I have absolute no idea, what an authority of type WILDCARD is meant to be.

2. The six users found by the lucene search are the users created manually in Alfresco. But there are also a few hundred users more created by LDAP sync, which are obviously not catched by the query.

So I wonder how I can add users to a group (with people.addAuthority) the right way and how I can catch all users (including users created by LDAP sync) in my search query.

Any hints and solutions are more than welcome.

Kind regards
Markus

cnguyen
Champ in-the-making
Champ in-the-making
Has there been any update on this? I am running Alfresco 3.4.4 Enterprise and I am still unable to add 'everyone' to the Email Contributor group. I would like to allow everyone (including non-users of the system) to email to specific email aliases in Alfresco. Manually adding users or groups to Email Contributor group is not an option for us.

As an aside, I think the current share GUI incorrectly conflates the two concepts of "role" and "group". Alfresco really needs to rework this GUI so that the two concepts are clearly separated out.


Regards,

-chi

mikeh
Star Contributor
Star Contributor
As an aside, I think the current share GUI incorrectly conflates the two concepts of "role" and "group". Alfresco really needs to rework this GUI so that the two concepts are clearly separated out.
Have you got any specific areas where you find this confusing?

Thanks,
Mike

cnguyen
Champ in-the-making
Champ in-the-making
Hi Mike,

"Have you got any specific areas where you find this confusing?"

I think in the admin GUI, conflating the two concepts of roles and groups is confusing and wrong. First, a role is really a set of permissions, whereas a group is a set of users. Applying that to real world situations, the logical operation one would do is to assign a role to specific users or groups, ie. user X has role Z, or group X has role Z. As it stands in the GUI, an admin user, without being aware of the implication, can assign a group to a role. In English, this translates to saying "role X has group Z", or "role X has user Y", which really doesn't make any logical sense. If Alfresco thinks that role and group is the same "thing", then the documentation should reflect that. But clearly they are different concepts, and as such, the GUI should reflect that.

However, I do not want to detract from my main concern which is the subject of this thread regarding the inability to have 'everyone' being assigned to the 'email contributor' role/group?

Regards,

-chi