Session Console and Internals.
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// Construction.
|
||||
[JsonConstructor]
|
||||
private SbmSecurityProfile() { }
|
||||
public SbmSecurityProfile(ISbmUserContext_Core userContext, bool includeHostSecurityProfile)
|
||||
public SbmSecurityProfile(ISbmUserOrganisationContext userContext, bool includeHostSecurityProfile)
|
||||
{
|
||||
this.UserContext = userContext;
|
||||
this.includeHostSecurityProfile = includeHostSecurityProfile;
|
||||
@@ -41,7 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
[JsonIgnore]
|
||||
public ISbmUserContext_Core UserContext { get; }
|
||||
public ISbmUserOrganisationContext UserContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Refresh profile.
|
||||
@@ -76,14 +76,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
this.hostSecurityProfile = hostSecurityProfile;
|
||||
RefreshProfileSettings(sessionConsole);
|
||||
}
|
||||
private void RefreshProfileSettings(SbmSessionConsole sessionConfig)
|
||||
private void RefreshProfileSettings(SbmSessionConsole sessionConsole)
|
||||
{
|
||||
RefreshAdminProfile(sessionConfig);
|
||||
RefreshManageProfile(sessionConfig);
|
||||
RefreshFinancialProfile(sessionConfig);
|
||||
RefreshContactsProfile(sessionConfig);
|
||||
RefreshTransactionProfile(sessionConfig);
|
||||
RefreshItemTypeProfile(sessionConfig);
|
||||
RefreshAdminProfile(sessionConsole);
|
||||
RefreshManageProfile(sessionConsole);
|
||||
RefreshFinancialProfile(sessionConsole);
|
||||
RefreshContactsProfile(sessionConsole);
|
||||
RefreshTransactionProfile(sessionConsole);
|
||||
RefreshItemTypeProfile(sessionConsole);
|
||||
// ToDo Commodities.
|
||||
}
|
||||
private void ClearProfile()
|
||||
@@ -135,7 +135,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public bool CanManageInterfaces { get; internal set; } = false;
|
||||
}
|
||||
public AdminProfile Admin { get; internal set; }
|
||||
private void RefreshAdminProfile(SbmSessionConsole sessionConfig)
|
||||
private void RefreshAdminProfile(SbmSessionConsole sessionConsole)
|
||||
{
|
||||
Admin.CanManageSecurity = UserHasSecurityRight(Sbm.SecurityRight.Security_Admin);
|
||||
Admin.CanManageDatabase = UserHasSecurityRight(Sbm.SecurityRight.Database_Admin);
|
||||
@@ -152,7 +152,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public bool CanManageTimesheets { get; internal set; } = false;
|
||||
}
|
||||
public ManageProfile Manage { get; internal set; }
|
||||
private void RefreshManageProfile(SbmSessionConsole sessionConfig)
|
||||
private void RefreshManageProfile(SbmSessionConsole sessionConsole)
|
||||
{
|
||||
Manage.CanManageTasks = UserHasSecurityRight(Sbm.SecurityRight.TaskManager);
|
||||
Manage.CanManageTimesheets = UserHasSecurityRight(Sbm.SecurityRight.TimesheetManager);
|
||||
@@ -172,7 +172,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public bool FinancialsAccessControl { get; internal set; }
|
||||
}
|
||||
public FinancialProfile Financial { get; internal set; }
|
||||
private void RefreshFinancialProfile(SbmSessionConsole sessionConfig)
|
||||
private void RefreshFinancialProfile(SbmSessionConsole sessionConsole)
|
||||
{
|
||||
Financial.ViewFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_View);
|
||||
Financial.UpdateFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_Update);
|
||||
@@ -181,7 +181,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
Financial.ViewCommoditySalesFinancials = UserCanAccessFinancialViewOfType(Sbm.FinancialType.CommoditySales);
|
||||
Financial.UpdateCommoditySalesFinancials = UserCanAccessFinancialUpdateOfType(Sbm.FinancialType.CommoditySales);
|
||||
// Config options.
|
||||
Financial.FinancialsAccessControl = (sessionConfig != null && !sessionConfig.AllowOption(Sbm.ConfigOption.AllowFinancialsAccessControl));
|
||||
Financial.FinancialsAccessControl = (sessionConsole != null && !sessionConsole.AllowOption(Sbm.ConfigOption.FinancialsAccessControl));
|
||||
}
|
||||
|
||||
private bool UserCanAccessFinancialViewOfType(Sbm.FinancialType financialType)
|
||||
@@ -245,7 +245,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public ContactsProfile Contacts { get; internal set; }
|
||||
public bool UserCanCreateContacts() { return Contacts.Create; }
|
||||
public bool UserCanUpdateContacts() { return Contacts.Update; }
|
||||
private void RefreshContactsProfile(SbmSessionConsole sessionConfig)
|
||||
private void RefreshContactsProfile(SbmSessionConsole sessionConsole)
|
||||
{
|
||||
Contacts.Update = (UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Update));
|
||||
Contacts.Create = (Contacts.Update || UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Create));
|
||||
@@ -285,7 +285,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
}
|
||||
public TransactionsProfile Transaction { get; internal set; }
|
||||
private void RefreshTransactionProfile(SbmSessionConsole sessionConfig)
|
||||
private void RefreshTransactionProfile(SbmSessionConsole sessionConsole)
|
||||
{
|
||||
Transaction.Update = (UserHasSecurityRight(Sbm.SecurityRight.Transaction_Update));
|
||||
Transaction.Create = (Transaction.Update || UserHasSecurityRight(Sbm.SecurityRight.Transaction_View));
|
||||
@@ -324,21 +324,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public bool StockControl { get; internal set; }
|
||||
}
|
||||
public ItemTypesProfile ItemType { get; } = new ItemTypesProfile();
|
||||
private void RefreshItemTypeProfile(SbmSessionConsole sessionConfig)
|
||||
private void RefreshItemTypeProfile(SbmSessionConsole sessionConsole)
|
||||
{
|
||||
ItemType.Processes = sessionConfig.AllowOption(Sbm.ConfigOption.AllowProcesses);
|
||||
ItemType.Contacts = sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts);
|
||||
ItemType.Commodities = sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities);
|
||||
ItemType.Portfolios = sessionConfig.AllowOption(Sbm.ConfigOption.AllowPortfolios);
|
||||
ItemType.PriceSets = sessionConfig.AllowOption(Sbm.ConfigOption.AllowPriceSets);
|
||||
ItemType.CommodityCustomers = sessionConfig.AllowOption(Sbm.ConfigOption.CommodityCustomers);
|
||||
ItemType.CommoditySuppliers = sessionConfig.AllowOption(Sbm.ConfigOption.CommoditySuppliers);
|
||||
ItemType.Transactions = sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions);
|
||||
ItemType.Assets = sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets);
|
||||
ItemType.Vehicles = sessionConfig.AllowOption(Sbm.ConfigOption.AllowVehicles);
|
||||
ItemType.StockLocations = sessionConfig.GetStockControlConfig().AllowStockLocations();
|
||||
ItemType.StockContainers = sessionConfig.GetStockControlConfig().AllowStockContainers();
|
||||
ItemType.StockControl = sessionConfig.GetStockControlConfig().AllowStockControl();
|
||||
ItemType.Processes = sessionConsole.AllowOption(Sbm.ConfigOption.Processes);
|
||||
ItemType.Contacts = sessionConsole.AllowOption(Sbm.ConfigOption.Contacts);
|
||||
ItemType.Commodities = sessionConsole.AllowOption(Sbm.ConfigOption.Commodities);
|
||||
ItemType.Portfolios = sessionConsole.AllowOption(Sbm.ConfigOption.Portfolios);
|
||||
ItemType.PriceSets = sessionConsole.AllowOption(Sbm.ConfigOption.PriceSets);
|
||||
ItemType.CommodityCustomers = sessionConsole.AllowOption(Sbm.ConfigOption.CommodityCustomers);
|
||||
ItemType.CommoditySuppliers = sessionConsole.AllowOption(Sbm.ConfigOption.CommoditySuppliers);
|
||||
ItemType.Transactions = sessionConsole.AllowOption(Sbm.ConfigOption.Transactions);
|
||||
ItemType.Assets = sessionConsole.AllowOption(Sbm.ConfigOption.Assets);
|
||||
ItemType.Vehicles = sessionConsole.AllowOption(Sbm.ConfigOption.Vehicles);
|
||||
ItemType.StockLocations = sessionConsole.GetStockControlConfig().AllowStockLocations();
|
||||
ItemType.StockContainers = sessionConsole.GetStockControlConfig().AllowStockContainers();
|
||||
ItemType.StockControl = sessionConsole.GetStockControlConfig().AllowStockControl();
|
||||
}
|
||||
|
||||
public bool ItemTypeIsAllowed(Sbm.ItemType itemType)
|
||||
|
||||
Reference in New Issue
Block a user