/// <summary> /// конструктор /// </summary> /// <param name="name"></param> /// <param name="repository"></param> public UserProvider(string name, IRepository repository) { userIdentity = new UserIndentity(); userIdentity.Init(name, repository); }
public bool ValidatePermissions(string controller, string action, string user, UserIndentity userIndentity, UserRoleEnum role) { if (userIndentity == null) { return false; } bool result = false; try { result = userIndentity.User.UserRole == (int)role; } catch (Exception) { result = false; } //if (user == "user1" && controller == "Home") //{ // switch (action) // { // case "Test": // isUserAccess = true; // break; // } //} //if (user == "user2" && controller == "Home") //{ // switch (action) // { // case "Edit": // isUserAccess = true; // break; // } //} //// Незарегистрированных ползователей пускаем на главную и "О проекте" //if (controller == "Home" && (action == "Index" || action == "About")) //{ // isUserAccess = true; //} return result; }