10-24-2014 06:16 AM
Is it possible to set all users lookup group to a common group?
Is it possible to do as a mas update without having to log in as each user to update?
10-24-2014 03:15 PM
We did something similar which I'm sure could be adapted. Basically we have over a thousand users and from time to time one or more of them get their settings out of whack or we descide that the default for a particular setting should be overridden for everyone.
First we modify the USEROPTIONDEF table to the default setting we want all users to have when they're first created (not sure if this applies to your scenario).
Then we added added a new Tasklet link to the \supportfiles\SmartParts\TaskPane\AdminTasks\UserTasklet.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UserTasklet.ascx.cs" Inherits="UserTaskletControl" %> <asp:HiddenField ID="hfSelections" runat="server" Value="" /> <asp:UpdatePanel UpdateMode="Conditional" runat="server" ID="SAG"> <ContentTemplate> <div data-dojo-type="Sage.TaskPane.UserTasklet" id="userTasklet"></div> <asp:Button runat="server" OnClick="tskAddUserToRole_Click" ID="tskAddUserToRole" CausesValidation="false" style="display:none;" /> <asp:Button runat="server" OnClick="tskResetUsers_Click" ID="tskResetUsers" CausesValidation="false" style="display:none;" /> <!-- 20140627.gdf.start --> <asp:Button runat="server" OnClick="tskResetUserOptions_Click" ID="tskResetUserOptions" CausesValidation="false" style="display:none;" /> <!-- 20140627.gdf.end -->
Then we add the click event code to the related UserTasklet.ascx.cs file to call the RemoveUserOptions() entity business rule method for the selected users
protected void tskResetUserOptions_Click(object sender, EventArgs e) { var selected = GetSelectedRecords(); foreach (var item in selected) { var user = Sage.Platform.EntityFactory.GetById<IUser>(item); string userId = user.Id.ToString(); Sage.Platform.Application.Services.IUserOptionsService userOption = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Application.Services.IUserOptionsService>(true); userOption.RemoveUserOptions(userId); } }
This essentially removes all their current custom settings and puts them back to our predetermined defaults (as we setup in the USEROPTIONDEF table).
Hope this helps