public IEnumerable<Action> BuildActions(Role role) { var actions = new List<Action>(); actions.Add(new Action("Analytics", "Stats/Index")); return actions; }
public IEnumerable<Action> BuildActions(Role role) { var actions = new List<Action>(); actions.Add(new Action(IUDICO.Statistics.Localization.getMessage("GetStats"), "Stats/Index")); actions.Add(new Action(IUDICO.Statistics.Localization.getMessage("QualityTest"), "QualityTest/SelectCurriculum")); return actions; }
public IEnumerable<Action> BuildActions(Role role) { var actions = new List<Action>(); actions.Add(new Action(IUDICO.CourseManagement.Localization.getMessage("GetCourses"), "Course/Index")); actions.Add(new Action(IUDICO.CourseManagement.Localization.getMessage("CreateCourse"), "Course/Create")); actions.Add(new Action(IUDICO.CourseManagement.Localization.getMessage("EditCourse"), "Course/Index")); return actions; }
public IEnumerable<IUDICO.Common.Models.Action> BuildActions(Role role) { var actions = new List<Action>(); // do not add actions for testing service //actions.Add(new Action("Import Testings", "Package/Index")); //actions.Add(new Action("Available Testings", "Training/Index")); return actions; }
public ActionResult Edit(int id, Role role) { if (ModelState.IsValid && Storage.EditRole(id, role)) { return RedirectToAction("Index"); } else { return View(role); } }
public ActionResult Create(Role role) { if (ModelState.IsValid && Storage.CreateRole(role)) { return RedirectToAction("Index"); } else { return View(role); } }
public IEnumerable<Action> BuildActions(Role role) { var actions = new List<Action> { new Action(IUDICO.UserManagement.Localization.getMessage("GetUsers"), "User/Index"), new Action(IUDICO.UserManagement.Localization.getMessage("GetGroups"), "Group/Index"), new Action(IUDICO.UserManagement.Localization.getMessage("Register"), "Account/Register"), new Action(IUDICO.UserManagement.Localization.getMessage("Login"), "Account/Login") }; return actions; }
public IEnumerable<Action> BuildActions(Role role) { var actions = new List<Action> { new Action(Localization.getMessage("GetUsers"), "User/Index"), new Action(Localization.getMessage("GetGroups"), "Group/Index"), new Action(Localization.getMessage("Register"), "Account/Register"), new Action(Localization.getMessage("ForgotPassword"), "Account/Forgot"), new Action(Localization.getMessage("Login"), "Account/Login"), }; return actions; }
public bool CreateRole(Role role) { try { db.Roles.InsertOnSubmit(role); db.SubmitChanges(); return true; } catch { return false; } }
public override void CreateRole(string roleName) { try { Role role = new Role { Name = roleName }; db.Roles.InsertOnSubmit(role); db.SubmitChanges(); } catch (Exception) { } }
protected bool IsAllowed(Action fullAction, Role role) { var parts = fullAction.Link.Split('/'); var controller = _Container.Resolve<IController>(parts[0] + "controller"); var action = controller.GetType().GetMethods().Where(m => m.Name == parts[1] && !IsPost(m) && m.GetParameters().Length == 0).FirstOrDefault(); var attribute = Attribute.GetCustomAttribute(action, typeof(AllowAttribute), false) as AllowAttribute; return attribute == null || Roles.Provider.IsUserInRole(HttpContext.Current.User.Identity.Name, attribute.Role.ToString()); }
public void AddUserToRole(Role role, User user) { var db = this.GetDbContext(); var userRole = new UserRole { RoleRef = (int)role, UserRef = user.Id }; db.UserRoles.InsertOnSubmit(userRole); db.SubmitChanges(); }
public IEnumerable<IUDICO.Common.Models.Action> BuildActions(Role role) { return Enumerable.Empty<IUDICO.Common.Models.Action>(); }
public IEnumerable<User> GetUsersInRole(Role role) { var db = this.GetDbContext(); var userIds = db.UserRoles.Where(ur => ur.RoleRef == (int)role).Select(ur => ur.UserRef); return db.Users.Where(u => userIds.Contains(u.Id)); }
public void RemoveUserFromRole(Role role, User user) { var db = this.GetDbContext(); var userRole = db.UserRoles.Single(g => g.RoleRef == (int)role && g.UserRef == user.Id); db.UserRoles.DeleteOnSubmit(userRole); db.SubmitChanges(); }
public bool EditRole(int id, Role role) { try { Role oldRole = GetRole(id); oldRole.Name = role.Name; db.SubmitChanges(); return true; } catch { return false; } }
public IEnumerable<Action> BuildActions(Role role) { return new List<Action>(); }
partial void InsertRole(Role instance);
public IEnumerable<Action> BuildActions(Role role) { List<Action> actions = new List<Action>(); actions.Add(new Action(IUDICO.CurriculumManagement.Localization.getMessage("CurriculumManagement"), "Curriculum/Index")); return actions; }
partial void UpdateRole(Role instance);
public IEnumerable<User> GetUsersInRole(Role role) { var db = GetDbContext(); return db.UserRoles.Where(ur => ur.RoleRef == (int) role).Select(ur => ur.User); }
partial void DeleteRole(Role instance);
public void AddUserToRole(Role role, User user) { this.storage.AddUserToRole(role, user); this.cacheProvider.Invalidate( "role-" + role, "user-id-" + user.Id, "user-name-" + user.Username, "users", "roles"); }
public IEnumerable<User> GetUsersInRole(Role role) { return this.cacheProvider.Get( "users-role-" + role, this.lockObject, () => this.storage.GetUsersInRole(role).ToList(), DateTime.Now, "users"); }