Hello all,
Is there a way to easily assign a new role to ALL users?
We have a situation in which we have 1300 users and we have to add a specific role to ALL.
Thanks a lot
Hello all,
Is there a way to easily assign a new role to ALL users?
We have a situation in which we have 1300 users and we have to add a specific role to ALL.
Thanks a lot
Hello Marco Ballarin
If you are able to access your database you can do the following SQL instruction
INSERT INTO acl_roles_users
(id, role_id, user_id, date_modified, deleted)
SELECT id, :role_id role_id, id user_id, CURRENT_TIMESTAMP() date_modified, 0 deleted FROM users u
so you can skid creating a program you only use once
Have a nice day
While direct inserts may well work, you need to be very cautious and know exactly what you are skipping by doing that.
For example, any associated logic hooks, and I assume process definitions, that would fire when using the proper bean factory would be skipped with direct insert.
Also, in general, there is always the potential for entering garbage into fields via direct insert (though that's true for beans too as things like dropdown lists and required fields are not checked when doing field value assignments), it's what makes API use so challenging and dangerous (see Idea: https://portal.sugarondemand.com/#supp_Bugs/91894 )
There could also be other processes behind the bean that would trigger with BeanFactory use but be skipped with direct insert.
Francesca
Completely right.
That's a good Best Practice I'll take into account from now on.
Thanks
Completely right.
That's a good Best Practice I'll take into account from now on.
Thanks