C# Class Cats.Services.Security.UserAccountService

Implementation for user account management. This service allows the creation and management of user accounts, authenticates users through username/password combination, encrypts password(s) and perform user account managment functions (change password, reset password and enable/disable) user accounts.
Inheritance: IUserAccountService
Afficher le fichier Open project: edgecomputing/cats Class Usage Examples

Méthodes publiques

Méthode Description
Add ( UserProfile entity, Dictionary roles ) : bool
Add ( UserProfile entity, string store, string application ) : bool
AddHubUser ( UserProfile entity, Dictionary roles, int HubId ) : bool
AddRole ( string user, string application, string role ) : bool
AddUserToRoles ( string userName, string Roles, string store, string application ) : void
AssociateRoles ( string username ) : void
Authenticate ( UserInfo info ) : bool
Authenticate ( UserProfile userInfo ) : bool
Authenticate ( string userName, string password ) : bool
ChangePassword ( UserProfile userInfo, string password ) : bool
ChangePassword ( int userId, string password ) : bool
ChangePassword ( string userName, string password ) : bool
Delete ( UserProfile entity ) : bool
DeleteById ( int id ) : bool
DisableAccount ( string userName ) : bool

Flips/Reverts the status of a user account. If an account is active it will disable it but if it is already disabled then it will activiate it by setting its value to 'enabled'.

Dispose ( ) : void
EditUserRole ( string owner, string userName, Dictionary applications ) : void
EnableAccount ( string userName ) : bool
FindBy ( bool>.Expression predicate ) : List
FindById ( int id ) : UserProfile
GenerateString ( Random rng, int length ) : string
GetAll ( ) : List
GetApplications ( string store ) : List
GetRoles ( string application ) : string[]

Get all roles associated with the application provided

GetRolesList ( string application ) : List
GetUserDetail ( int userId ) : UserProfile

Returns the detail of a given user based on supplied UserId

GetUserDetail ( string userName ) : UserProfile

Returns the detail of a given user based on supplied userName

GetUserInfo ( int userId ) : UserInfo
GetUserInfo ( string userName ) : UserInfo

Returns the user info based on supplied username

GetUserPermissions ( string UserName ) : List
GetUserPermissions ( string userName, string store, string application ) : List
GetUserPermissionsNotification ( string UserName ) : List
GetUserPermissionsNotification ( string userName, string store, string application ) : List
GetUserPreferences ( ) : List

Gets list of all user preferences

GetUserRoles ( string username ) : string[]
GetUsers ( ) : List
HashPassword ( string password ) : string

Encrypts a given string (password) using the SHA1 cryptography algorithm

RemoveRole ( string user, string application, string role ) : bool
ResetPassword ( UserInfo userInfo ) : string
ResetPassword ( string userName ) : string
Save ( UserProfile entity ) : bool
UpdateUser ( UserProfile entity ) : bool
UserAccountService ( ) : System
UserAccountService ( IUnitOfWork unitOfWork, IAzManStorage store, NetSqlAzManRoleProvider provider ) : System

Private Methods

Méthode Description
CheckAccess ( IAzManDBUser dbUser, string app, string role, IAzManStorage storage ) : bool

Retrive a complete Authorization for the current user and populate the string array from .NetSqlAzMan store

ConfigureAuthorizationRoleProvider ( string store, string application ) : System.Collections.Specialized.NameValueCollection
ConfigureRoleProvider ( string store ) : System.Collections.Specialized.NameValueCollection
GenerateChar ( Random rng ) : char

Method Details

Add() public méthode

public Add ( UserProfile entity, Dictionary roles ) : bool
entity Cats.Models.Security.UserProfile
roles Dictionary
Résultat bool

Add() public méthode

public Add ( UserProfile entity, string store, string application ) : bool
entity Cats.Models.Security.UserProfile
store string
application string
Résultat bool

AddHubUser() public méthode

public AddHubUser ( UserProfile entity, Dictionary roles, int HubId ) : bool
entity Cats.Models.Security.UserProfile
roles Dictionary
HubId int
Résultat bool

AddRole() public méthode

public AddRole ( string user, string application, string role ) : bool
user string
application string
role string
Résultat bool

AddUserToRoles() public méthode

public AddUserToRoles ( string userName, string Roles, string store, string application ) : void
userName string
Roles string
store string
application string
Résultat void

AssociateRoles() public méthode

public AssociateRoles ( string username ) : void
username string
Résultat void

Authenticate() public méthode

public Authenticate ( UserInfo info ) : bool
info UserInfo
Résultat bool

Authenticate() public méthode

public Authenticate ( UserProfile userInfo ) : bool
userInfo UserProfile
Résultat bool

Authenticate() public méthode

public Authenticate ( string userName, string password ) : bool
userName string
password string
Résultat bool

ChangePassword() public méthode

public ChangePassword ( UserProfile userInfo, string password ) : bool
userInfo UserProfile
password string
Résultat bool

ChangePassword() public méthode

public ChangePassword ( int userId, string password ) : bool
userId int
password string
Résultat bool

ChangePassword() public méthode

public ChangePassword ( string userName, string password ) : bool
userName string
password string
Résultat bool

Delete() public méthode

public Delete ( UserProfile entity ) : bool
entity UserProfile
Résultat bool

DeleteById() public méthode

public DeleteById ( int id ) : bool
id int
Résultat bool

DisableAccount() public méthode

Flips/Reverts the status of a user account. If an account is active it will disable it but if it is already disabled then it will activiate it by setting its value to 'enabled'.
public DisableAccount ( string userName ) : bool
userName string The account to enable/disable
Résultat bool

Dispose() public méthode

public Dispose ( ) : void
Résultat void

EditUserRole() public méthode

public EditUserRole ( string owner, string userName, Dictionary applications ) : void
owner string
userName string
applications Dictionary
Résultat void

EnableAccount() public méthode

public EnableAccount ( string userName ) : bool
userName string
Résultat bool

FindBy() public méthode

public FindBy ( bool>.Expression predicate ) : List
predicate bool>.Expression
Résultat List

FindById() public méthode

public FindById ( int id ) : UserProfile
id int
Résultat UserProfile

GenerateString() public méthode

public GenerateString ( Random rng, int length ) : string
rng Random
length int
Résultat string

GetAll() public méthode

public GetAll ( ) : List
Résultat List

GetApplications() public méthode

public GetApplications ( string store ) : List
store string
Résultat List

GetRoles() public méthode

Get all roles associated with the application provided
public GetRoles ( string application ) : string[]
application string The application name
Résultat string[]

GetRolesList() public méthode

public GetRolesList ( string application ) : List
application string
Résultat List

GetUserDetail() public méthode

Returns the detail of a given user based on supplied UserId
public GetUserDetail ( int userId ) : UserProfile
userId int Unique id identifying the user
Résultat UserProfile

GetUserDetail() public méthode

Returns the detail of a given user based on supplied userName
public GetUserDetail ( string userName ) : UserProfile
userName string User name identifying the user
Résultat UserProfile

GetUserInfo() public méthode

public GetUserInfo ( int userId ) : UserInfo
userId int
Résultat UserInfo

GetUserInfo() public méthode

Returns the user info based on supplied username
public GetUserInfo ( string userName ) : UserInfo
userName string User name identifying the user
Résultat UserInfo

GetUserPermissions() public méthode

public GetUserPermissions ( string UserName ) : List
UserName string
Résultat List

GetUserPermissions() public méthode

public GetUserPermissions ( string userName, string store, string application ) : List
userName string
store string
application string
Résultat List

GetUserPermissionsNotification() public méthode

public GetUserPermissionsNotification ( string UserName ) : List
UserName string
Résultat List

GetUserPermissionsNotification() public méthode

public GetUserPermissionsNotification ( string userName, string store, string application ) : List
userName string
store string
application string
Résultat List

GetUserPreferences() public méthode

Gets list of all user preferences
public GetUserPreferences ( ) : List
Résultat List

GetUserRoles() public méthode

public GetUserRoles ( string username ) : string[]
username string
Résultat string[]

GetUsers() public méthode

public GetUsers ( ) : List
Résultat List

HashPassword() public méthode

Encrypts a given string (password) using the SHA1 cryptography algorithm
public HashPassword ( string password ) : string
password string string (passowrd) to encrypt
Résultat string

RemoveRole() public méthode

public RemoveRole ( string user, string application, string role ) : bool
user string
application string
role string
Résultat bool

ResetPassword() public méthode

public ResetPassword ( UserInfo userInfo ) : string
userInfo UserInfo
Résultat string

ResetPassword() public méthode

public ResetPassword ( string userName ) : string
userName string
Résultat string

Save() public méthode

public Save ( UserProfile entity ) : bool
entity UserProfile
Résultat bool

UpdateUser() public méthode

public UpdateUser ( UserProfile entity ) : bool
entity UserProfile
Résultat bool

UserAccountService() public méthode

public UserAccountService ( ) : System
Résultat System

UserAccountService() public méthode

public UserAccountService ( IUnitOfWork unitOfWork, IAzManStorage store, NetSqlAzManRoleProvider provider ) : System
unitOfWork IUnitOfWork
store IAzManStorage
provider NetSqlAzManRoleProvider
Résultat System