Interface IAuthorizationService
Namespace: Simplic.Authorization
Assembly: Simplic.Authorization.dll
Syntax
public interface IAuthorizationService
Methods
| Improve this Doc View SourceConvertBitToInt(String)
Converts a bit set ( bit mask ) to a list of integers
Declaration
IList<int> ConvertBitToInt(string bits)
Parameters
Type | Name | Description |
---|---|---|
System.String | bits | Bit set ( bit mask ) |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<System.Int32> |
CopyFrom(String, String, Object, String, String, Object)
Copies the access rights of a given row to the desired row
Declaration
bool CopyFrom(string tableNameFrom, string idColNameFrom, object rowIdFrom, string tableNameTo, string idColNameTo, object rowIdTo)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableNameFrom | Table to copy from |
System.String | idColNameFrom | Name of the id column to copy from |
System.Object | rowIdFrom | Actual row id to copy from |
System.String | tableNameTo | Table to save to |
System.String | idColNameTo | Name of the id column to save to |
System.Object | rowIdTo | Actual row id to save to |
Returns
Type | Description |
---|---|
System.Boolean | true if successfull |
CreateBitMask(IList<Int32>)
Queries the database to return a bit set containing all the numbers given
Declaration
string CreateBitMask(IList<int> numbers)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<System.Int32> | numbers | A list of numbers |
Returns
Type | Description |
---|---|
System.String | A string containing a bit set of numbers given |
CreateBitMask(Int32)
Queries the database to return a bit set
Declaration
string CreateBitMask(int number)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | number | A number to convert to a bit set |
Returns
Type | Description |
---|---|
System.String | A string containing a bit set of numbers |
GenerateAccessRightsStatement(AccessRightType, Int32, String, String, String)
Creates the where condition for a particular table and row
Declaration
string GenerateAccessRightsStatement(AccessRightType type, int userId, string userBitMask, string userGroupBitMask, string tableAlias = "")
Parameters
Type | Name | Description |
---|---|---|
AccessRightType | type | What kind of statement to be generated |
System.Int32 | userId | User id |
System.String | userBitMask | User id converted to bit mask |
System.String | userGroupBitMask | User access groups converted to bit mask |
System.String | tableAlias | Optional table alias e.g. SQL = TableName as tn, tableAlias="tn" |
Returns
Type | Description |
---|---|
System.String | Where condition for a row level access control |
GetAccessRights(String, String, Object)
Gets the RowAccess of given row id
Declaration
RowAccess GetAccessRights(string tableName, string idColName, object rowId)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Table to query |
System.String | idColName | Name of the id column |
System.Object | rowId | Actual row id |
Returns
Type | Description |
---|---|
RowAccess | Access rights of given row of the given table |
GetOwnerId(String, String, Object)
Gets an owner id of a given row
Declaration
int GetOwnerId(string tableName, string idColName, object rowId)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Table to use |
System.String | idColName | Name of the id column |
System.Object | rowId | Actual row id |
Returns
Type | Description |
---|---|
System.Int32 | true if successfull |
HasAccess(AccessRightType, String, String, Object, Session.Session)
Checks if the given user has access
Declaration
bool HasAccess(AccessRightType type, string tableName, string idColName, object rowId, Session.Session session)
Parameters
Type | Name | Description |
---|---|---|
AccessRightType | type | What kind of statement to be generated |
System.String | tableName | Table name |
System.String | idColName | Id column name |
System.Object | rowId | Row id |
Session.Session | session | User session |
Returns
Type | Description |
---|---|
System.Boolean | True if the user has access |
HasAccess(AccessRightType, String, String, Object, Int32, String, String)
Checks if the given user has access
Declaration
bool HasAccess(AccessRightType type, string tableName, string idColName, object rowId, int userId, string userBitMask, string userGroupBitMask)
Parameters
Type | Name | Description |
---|---|---|
AccessRightType | type | What kind of statement to be generated |
System.String | tableName | Table name |
System.String | idColName | Id column name |
System.Object | rowId | Row id |
System.Int32 | userId | User id |
System.String | userBitMask | User id converted to bit mask |
System.String | userGroupBitMask | User access groups converted to bit mask |
Returns
Type | Description |
---|---|
System.Boolean | True if the user has access |
Migrate()
Creates new columns and converts all existing access rights
Declaration
IList<MigrationResult> Migrate()
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<MigrationResult> |
ResetAccess(String, String, Object)
Sets all access rights to null of a given row
Declaration
bool ResetAccess(string tableName, string idColName, object rowId)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Table to use |
System.String | idColName | Name of the id column |
System.Object | rowId | Actual row id |
Returns
Type | Description |
---|---|
System.Boolean | true if successfull |
SetAccess(String, String, Object, RowAccess)
Sets the access rights for a given row in the given table
Declaration
bool SetAccess(string tableName, string idColName, object rowId, RowAccess rowAccess)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Table to use |
System.String | idColName | Name of the id column |
System.Object | rowId | Actual row id |
RowAccess | rowAccess | Access rights of this spesific row |
Returns
Type | Description |
---|---|
System.Boolean | true if successfull |
SetOwner(String, String, Object, Int32)
Sets the owner of a given row
Declaration
bool SetOwner(string tableName, string idColName, object rowId, int ownerId)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Table to use |
System.String | idColName | Name of the id column |
System.Object | rowId | Actual row id |
System.Int32 | ownerId | Owner Id (User Id) |
Returns
Type | Description |
---|---|
System.Boolean | true if successfull |