Class SecuritySession
Security session base class
Namespace: XData.Security
Assembly: XData.Security.docfx.dll
Syntax
public abstract class SecuritySession : ISecuritySession
Constructors
| Improve this Doc View SourceSecuritySession(String, String[], Boolean)
Security session constructor
Declaration
public SecuritySession(string userName, string[] roles, bool isSupervisor = false)
Parameters
Type | Name | Description |
---|---|---|
String | userName | User name |
String[] | roles | User roles |
Boolean | isSupervisor | Supervisor flag |
Properties
| Improve this Doc View SourceIsSupervisor
Current user is supervisor flag
Declaration
public bool IsSupervisor { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Roles
Current user roles list
Declaration
public string[] Roles { get; protected set; }
Property Value
Type | Description |
---|---|
String[] |
UserName
Current user name
Declaration
public string UserName { get; protected set; }
Property Value
Type | Description |
---|---|
String |
Methods
| Improve this Doc View SourceAction<T>(Expression<Func<CustomLogic<T>>>)
Custom action name access helper
Declaration
protected static string Action<T>(Expression<Func<CustomLogic<T>>> expr)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<CustomLogic<T>>> | expr | Custom logic expression |
Returns
Type | Description |
---|---|
String | Custom action name |
Type Parameters
Name | Description |
---|---|
T | Data object type |
FilterGrantedObjects<T>(String, Expression)
Converts initial IQueryable expression filtering granted objects only
Declaration
public Expression FilterGrantedObjects<T>(string context, Expression allDataExpr)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
String | context | Context name |
Expression | allDataExpr | Initial IQueryable expression |
Returns
Type | Description |
---|---|
Expression | Modified IQueryable expression |
Type Parameters
Name | Description |
---|---|
T | Data object type |
GetGrantedActions<T>(String)
Returns list of granted actions for current user
Declaration
public string[] GetGrantedActions<T>(string context = null)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
String | context | Context name |
Returns
Type | Description |
---|---|
String[] | Actions list |
Type Parameters
Name | Description |
---|---|
T | Data object type |
GetRestrictedProperties<T>(String)
Returns list of restricted properties for current user
Declaration
public string[] GetRestrictedProperties<T>(string context = null)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
String | context | Context name |
Returns
Type | Description |
---|---|
String[] | Properties name list |
Type Parameters
Name | Description |
---|---|
T | Data object type |
InitializeSession()
Session initialization
Declaration
protected abstract void InitializeSession()
See Also
Property<T>(Expression<Func<T, Object>>)
Property name access helper
Declaration
protected static string Property<T>(Expression<Func<T, object>> expr)
where T : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, Object>> | expr | Property expression |
Returns
Type | Description |
---|---|
String | Property name |
Type Parameters
Name | Description |
---|---|
T | Data object type |
RegisterGrantedActions(String, Type, IEnumerable<KeyValuePair<String, String[]>>)
Granted actions registration
Declaration
protected void RegisterGrantedActions(string context, Type type, IEnumerable<KeyValuePair<string, string[]>> actions)
Parameters
Type | Name | Description |
---|---|---|
String | context | Context name |
Type | type | Data type to grant actions |
IEnumerable<KeyValuePair<String, String[]>> | actions | Granted actions |
RegisterRestrictedProperties(String, Type, IEnumerable<KeyValuePair<String, String[]>>)
Restricted properties registration
Declaration
protected void RegisterRestrictedProperties(string context, Type type, IEnumerable<KeyValuePair<string, string[]>> restricted)
Parameters
Type | Name | Description |
---|---|---|
String | context | Context name |
Type | type | Data type to restrict property access |
IEnumerable<KeyValuePair<String, String[]>> | restricted | Restricted properties |
RegisterSecurityFilters(String, Type, IEnumerable<KeyValuePair<String, Expression>>)
Security filters registration
Declaration
protected void RegisterSecurityFilters(string context, Type type, IEnumerable<KeyValuePair<string, Expression>> filters)
Parameters
Type | Name | Description |
---|---|---|
String | context | Context name |
Type | type | Data type to filter data |
IEnumerable<KeyValuePair<String, Expression>> | filters | Security filters |