I am trying to add this via the API.
I am using the following code:
IPluginInfo pluginInfo = pluginManager.Plugins.OrderByDescending(p => p.LastModifiedOn) .FirstOrDefault() as IPluginInfo;
var plugin = await pluginManager.GetPluginAsync(pluginInfo);
ISecurityManager securityManager = (ISecurityManager)server.GetService(typeof(ISecurityManager));
ISecurityIdentity mainUserGrp = securityManager.Identities
.Where(t => t.Enabled && !t.Deleted && t.FullName.Contains("SoftPro All Users"))
.FirstOrDefault();
if (mainUserGrp != null)
{
Console.WriteLine($"Adding User Group {mainUserGrp.Name}");
if (plugin != null)
{
Console.WriteLine($"plugin {plugin.Name}");
plugin.Members.Add(mainUserGrp);
}
}
Everything seems to be working well, code finds my group and plugin but the group just does not get added.
Do you know if this is working properly in the current 4.6.2 version?
Adding groups to plugin package via the API
Re: Adding groups to plugin package via the API
Code: Select all
if (plugin != null)
{
Console.WriteLine($"plugin {plugin.Name}");
plugin.Members.Add(mainUserGrp);
}
Code: Select all
pluginManager.ApplyChanges(plugin);
Yatin Tawde
Softpro
Software Engineer
Softpro
Software Engineer
Re: Adding groups to plugin package via the API
I added that line
pluginManager.ApplyChanges(plugin);
and sure enough it adds the member group to the plugin.
But then for some reason Select does not load my custom code, it seems to mess up the plugin.
I tested to make sure I re-installed the plugin and i don't add the group via the API, rather i add it manually after the plugin is installed
then the code loads just fine.
pluginManager.ApplyChanges(plugin);
and sure enough it adds the member group to the plugin.
But then for some reason Select does not load my custom code, it seems to mess up the plugin.
I tested to make sure I re-installed the plugin and i don't add the group via the API, rather i add it manually after the plugin is installed
then the code loads just fine.