How can I move all old user groups to the new _Default_
How can I move all old user groups to the new _Default_
I have a lot of users who are part of a one person group with the group name of their email address. Is there a bulk way of converting all of them to the new _Default_ Group?
I tried the following
update ac_UserGroups
set groupid = 383 ' _Default_ group
where groupid <> 383
and groupid > 9 ' all my admin groups are below nine.
I get this error
Msg 2601, Level 14, State 1, Line 1
Cannot insert duplicate key row in object 'dbo.ac_UserGroups' with unique index 'ac_UserGroups_CK'.
The statement has been terminated.
I don't see a way to do this in the admin either other than one at a time and that is WAY to many...
Thanks
I tried the following
update ac_UserGroups
set groupid = 383 ' _Default_ group
where groupid <> 383
and groupid > 9 ' all my admin groups are below nine.
I get this error
Msg 2601, Level 14, State 1, Line 1
Cannot insert duplicate key row in object 'dbo.ac_UserGroups' with unique index 'ac_UserGroups_CK'.
The statement has been terminated.
I don't see a way to do this in the admin either other than one at a time and that is WAY to many...
Thanks
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: How can I move all old user groups to the new _Default_
It looks like you might need to add a criteria that the userid is not already in group 383. It looks like Able adds users to the default group at upgrade time.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: How can I move all old user groups to the new _Default_
Use this query, it will add new user -> group relation for all users except admin users (groupId > 9) and anonymous users and users which are already not assigned to default group.
Code: Select all
INSERT INTO ac_UserGroups(UserId, GroupId)
SELECT UserId, 383
FROM ac_Users WHERE UserId NOT IN
(SELECT DISTINCT U.UserId FROM ac_Users U LEFT JOIN ac_UserGroups UG ON U.UserId = UG.UserId
WHERE (UG.GroupId = 383 OR UG.UserId IS NOT NULL OR UG.GroupId < 9))
AND IsAnonymous = 0
Thanks for your support
Naveed Ashraf
.com
AbleCommerce Help Center
AbleCommerce Developer WIKI
Follow us on Twitter
Naveed Ashraf
.com
AbleCommerce Help Center
AbleCommerce Developer WIKI
Follow us on Twitter
Re: How can I move all old user groups to the new _Default_
Thanks for the script but it returns 0 rows affected and in fact did not affect any of the user group assignments. Any other ideas?
Re: How can I move all old user groups to the new _Default_
Are you going to use the old groups anymore? If not just delete them and if there are users in that group, the admin page will go to another that will allow you to select the group you want those users to be moved to.
Ryan A.
Scott's Bait and Tackle
http://store.scottsbt.com
Work In Progress
Able Gold R10
Bootstrap 3.3
Scott's Bait and Tackle
http://store.scottsbt.com
Work In Progress
Able Gold R10
Bootstrap 3.3
Re: How can I move all old user groups to the new _Default_
Yes I can do that but each user is in their own group. so I have LOTS of groups each with 1 member. I don't know if that was the original design of Able or a result of my accounting system integration with Able but that is where it is and I don't have the time to change the group of each user one at a time. I was hoping for a script to move them all to the _Default_ Group and then I can just delete the unused groups.
Re: How can I move all old user groups to the new _Default_
Ah. Well if you don't have a time emergency , I might be able to have a solution available after Christmas that you can use.
Ryan A.
Scott's Bait and Tackle
http://store.scottsbt.com
Work In Progress
Able Gold R10
Bootstrap 3.3
Scott's Bait and Tackle
http://store.scottsbt.com
Work In Progress
Able Gold R10
Bootstrap 3.3
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: How can I move all old user groups to the new _Default_
Did you look at some of the users in the admin to make sure they are not in the default group already? Or do you have some custom code to create users that overrode the upgrade?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: How can I move all old user groups to the new _Default_
I resorted to brute force and got everyone in the office removing the people for the groups and assigning them to the default. tedious but done.