Consolidate User Context
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Core
|
||||
{
|
||||
//=======================================================================
|
||||
public interface ISbmSecurityProfile
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// User properties.
|
||||
SysId UserId { get; }
|
||||
String UserDisplayName { get; }
|
||||
String UserLocation { get; }
|
||||
DateTime UserLastLogin { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security - Contacts.
|
||||
bool UserCanCreateContacts { get; }
|
||||
bool UserCanUpdateContacts { get; }
|
||||
|
||||
// Security - Financials.
|
||||
bool UserCanViewFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any);
|
||||
bool UserCanUpdateFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any);
|
||||
bool UserCanAccessFinancialViewOfType(Sbm.FinancialType financialType = Sbm.FinancialType.Any);
|
||||
bool UserCanAccessFinancialUpdateOfType(Sbm.FinancialType financialType = Sbm.FinancialType.Any);
|
||||
|
||||
// Security - Transactions.
|
||||
bool UserCanAccessTransactionsOfType(Sbm.TransactionType transactionType);
|
||||
|
||||
// Security Item types.
|
||||
bool ItemTypeIsAllowed(Sbm.ItemType itemType);
|
||||
bool UserCanCreateItemType(Sbm.ItemType itemType);
|
||||
bool UserCanUpdateItemType(Sbm.ItemType itemType);
|
||||
bool UserCanRemoveItemType(Sbm.ItemType itemType);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Refresh profile.</summary>
|
||||
void RefreshProfile(SbmConfigConsole configConsole, SaSecurityConsole securityConsole, SysId userId, List<TypeCodeDesc> securityRights);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Core
|
||||
{
|
||||
//=======================================================================
|
||||
public interface ISbmUserContext
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Session Context - Identifies database connections etc.</summary>
|
||||
SbmSessionContext SessionContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>User data - account details.</summary>
|
||||
public interface IUserData
|
||||
{
|
||||
/// <summary>User Security Item Id.</summary>
|
||||
SysId SecurityItemId { get; }
|
||||
/// <summary>User Affiliate Id.</summary>
|
||||
SysId AffiliateId { get; }
|
||||
/// <summary>User first name.</summary>
|
||||
String FirstName { get; }
|
||||
/// <summary>User last name.</summary>
|
||||
String LastName { get; }
|
||||
/// <summary>User display name.</summary>
|
||||
String DisplayName { get; }
|
||||
/// <summary>User email address.</summary>
|
||||
String EmailAddress { get; }
|
||||
/// <summary>User managed organisations - Affiliate Id and display name.</summary>
|
||||
List<SysIdString> SupervisedOrganisations { get; }
|
||||
}
|
||||
|
||||
/// <summary>Current user account details.</summary>
|
||||
IUserData User { get; }
|
||||
bool ValidUser { get; }
|
||||
|
||||
/// <summary>Database upfate info - user session specific properties for database inserts/updates.</summary>
|
||||
DbUpdateInfo DbUpdateInfo { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Security profile - what the user is allowed to do based on security roles and groups.</summary>
|
||||
ISbmSecurityProfile SecurityProfile { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>User data - logged in account details.</summary>
|
||||
public interface IOrganisationData
|
||||
{
|
||||
/// <summary>Organisation Affiliate Id.</summary>
|
||||
SysId AffiliateId { get; }
|
||||
/// <summary>Organisation Affiliate Type.</summary>
|
||||
Sbm.AffiliateType AffiliateType { get; }
|
||||
/// <summary>Organisation display name.</summary>
|
||||
String DisplayName { get; }
|
||||
/// <summary>Organisation Interface context - to qualify interfaces belonging to the organisation.</summary>
|
||||
public String InterfaceContext { get; }
|
||||
/// <summary>Organisation 'Internal' Association Id.</summary>
|
||||
public SysId AssociationId { get; }
|
||||
}
|
||||
|
||||
/// <summary>Current selected organisation.</summary>
|
||||
IOrganisationData Organisation { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation configuration.
|
||||
String GetOrganisationOption(Sbm.OrganisationOption option, String context);
|
||||
String GetOrganisationOption(String optionName, String context);
|
||||
String GetOwnerOption_Value(Sbm.OrgOption_Value eCol);
|
||||
String GetOwnerOption_Folder(Sbm.OrgOption_Folder eCol);
|
||||
bool GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption eCol);
|
||||
String GetOwnerOption_Caption(Sbm.OrgOption_Caption eCol, String defaultValue);
|
||||
bool GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx eCol);
|
||||
bool GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn eCol);
|
||||
String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx eCol, String defautValue);
|
||||
int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes eLimit, int defautValue);
|
||||
int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays eLimit, int defautValue);
|
||||
int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks eLimit, int defautValue);
|
||||
int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals eNumDecimals, int defautValue = 2);
|
||||
Sbm.CommodityType GetOwnerOption_CommodityType(Sbm.OrgOption_CommodityType commodityTypeContext);
|
||||
SysId GetOwnerOption_StockLocation(Sbm.OrgOption_StockLocation eLoc);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user