Page 1 of 2
Replicating user profile

Posted:
Mon Apr 04, 2016 3:24 pm
by Atronics
How can I incorporate a SQL script to replicate a "standard user"profile to the user logging in to Jiwa? i.e the user's profile is updated on login.
Re: Replicating user profile 

Posted:
Mon Apr 04, 2016 4:38 pm
by Mike.Sheen
Atronics wrote:How can I incorporate a SQL script to replicate a "standard user"profile to the user logging in to Jiwa? i.e the user's profile is updated on login.
The attached plugin will do this.
Once imported and enabled, You will need to set a system setting to nominate which staff member is the model user to copy system profile data from.
Re: Replicating user profile

Posted:
Tue Apr 05, 2016 9:19 am
by Atronics
Thanks, Mike. That's a very neat solution.
Re: Replicating user profile

Posted:
Wed Jun 02, 2021 2:22 pm
by pricerc
This seems to not work so good in 7.2.1 SR4.
Getting a NullReferenceException at when trying to lookup the template staff member in System Config on the staff.Search line.
- Code: Select all
public void ButtonClicked(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic BusinessLogicHost, JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid GridObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm FormObject, int Col, int Row, JiwaFinancials.Jiwa.JiwaApplication.SystemSettings.Setting SystemSetting)
{
if (SystemSetting.IDKey == "ModelUser") {
var staff = new JiwaFinancials.Jiwa.JiwaApplication.Entities.Staff.Staff();
staff.Search(FormObject.Form);
SystemSetting.Contents = staff.RecID;
SystemSetting.DisplayContents = staff.DisplayName;
}
}
Re: Replicating user profile

Posted:
Wed Jun 02, 2021 2:45 pm
by Mike.Sheen
This isn't right anymore:
- Code: Select all
var staff = new JiwaFinancials.Jiwa.JiwaApplication.Entities.Staff.Staff();
We now
require factories to create entities.
I'll update the plugin and post it back here.
Re: Replicating user profile

Posted:
Wed Jun 02, 2021 2:57 pm
by Mike.Sheen
Plugin updated to work with the changes introduced since the original plugin was published. Tested and verified as working on 7.2.1.
Re: Replicating user profile

Posted:
Wed Jun 02, 2021 3:33 pm
by pricerc
Mike.Sheen wrote:Plugin updated to work with the changes introduced since the original plugin was published. Tested and verified as working on 7.2.1.
Thanks Mike.
Thought it would be something simple - but you got it sorted for me on my drive home, and it would have taken me longer than that to figure it out!
Re: Replicating user profile

Posted:
Thu Jun 03, 2021 9:07 pm
by pricerc
Do the saved TabControlSettings for a user only store modifications from the default that a user has made, or is it everything that could potentially be customised?
e.g. If I have a user who only deals with sales, and has modified the details grid on their S/O entry, but none of the other screens in the system, will their profile only include SO customisations, or would it also include, say, purchasing settings, even if they never use purchasing ?
Where I'm heading with this is: is there scope for having a 'merge' profile variation on this plugin, where we can customise/standardise parts of the UI, but leave other parts for individual management?
(I'm happy to tackle the work, but don't want to waste time trying to figure out how if it would be a pointless exercise).
Re: Replicating user profile

Posted:
Fri Jun 04, 2021 12:01 am
by pricerc
So here's a slightly more sophisticated version of the plugin.
Changes from Mike's code:
(1) in addition to a global setting, adds a staff record custom field that allows selection of another staff member to use as a profile source. So you could have several different 'template' users, and assign users to different templates.
(2) adds another (optional) global setting for choosing a user group. If the user logging on is a member of this group, then they will *not* load the global profile.
(3) if the model profile is not found, then the process is aborted without first clearing the user settings, i.e. they will get the 'default' settings for the user.
Notes:
Setting a user profile to the same user is the same as not specifying one at all, and the user will be subject to the global setting if they are not also a member of the "personal profile" user group.
Re: Replicating user profile

Posted:
Fri Jun 11, 2021 11:18 am
by pricerc
I just want to 'bump' this question, which I think may have gotten lost by my subsequent post.
pricerc wrote:Do the saved TabControlSettings for a user only store modifications from the default that a user has made, or is it everything that could potentially be customised?
e.g. If I have a user who only deals with sales, and has modified the details grid on their S/O entry, but none of the other screens in the system, will their profile only include SO customisations, or would it also include, say, purchasing settings, even if they never use purchasing ?
Where I'm heading with this is: is there scope for having a 'merge' profile variation on this plugin, where we can customise/standardise parts of the UI, but leave other parts for individual management?
(I'm happy to tackle the work, but don't want to waste time trying to figure out how if it would be a pointless exercise).
(it would be a pointless exercise if a profile contains *all* items not just *customised* items)