public void Delete(int roleId) { #region Logging if (log.IsDebugEnabled) log.Debug(Messages.MethodEnter); #endregion RoleSvc roleSvc = new RoleSvc(); Role role = roleSvc.Get(roleId); roleSvc.Delete(role); Hashtable args = new Hashtable(); args["applicationId"] = role.Application.Id; this.RedirectToAction("default", args); #region Logging if (log.IsDebugEnabled) log.Debug(Messages.MethodLeave); #endregion }
public void Edit(int roleId) { #region Logging if (log.IsDebugEnabled) log.Debug(Messages.MethodEnter); #endregion RoleSvc roleSvc = new RoleSvc(); Role role = roleSvc.Get(roleId); Application application = new ApplicationSvc().Get(role.Application.Id); IList<SecurableObjectType> securableObjectTypes = new SecurableObjectTypeSvc().Get(application); SecurableObjectType securableObjectType = new SecurableObjectTypeSvc().Get(role.Application, role.SecurableObjectType.Id); RightCollection rights = new RightSvc().Get(securableObjectType); RoleRightAssignmentCollection roleRightAssignments = new RoleRightAssignmentSvc().Get(role); IList<GrantedRight> grantedRights = new List<GrantedRight>(); foreach (Right right in rights) { GrantedRight grantedRight = new GrantedRight() { Id = right.Id, Name = right.Name, Description = right.Description, Application = right.Application, SecurableObjectType = right.SecurableObjectType }; foreach (RoleRightAssignment rra in roleRightAssignments) { if (rra.Right.Id == right.Id) { grantedRight.IsGranted = true; break; } } grantedRights.Add(grantedRight); } this.PropertyBag["rights"] = grantedRights; this.PropertyBag["role"] = role; this.PropertyBag["securableObjectTypes"] = securableObjectTypes; this.AddToBreadcrumbTrail(new Link() { Text = "Home", Controller = "home", Action = "default" }); this.AddToBreadcrumbTrail(new Link() { Text = application.Name, Controller = "application", Action = "display", QueryString = string.Format("applicationId={0}", application.Id) }); this.AddToBreadcrumbTrail(new Link() { Text = "Roles", Controller = "role", Action = "default", QueryString = string.Format("applicationId={0}", application.Id) }); this.AddToBreadcrumbTrail(new Link() { Text = role.Name, Controller = "role", Action = "display", QueryString = string.Format("roleId={0}", roleId) }); this.AddToBreadcrumbTrail(new Link() { Text = "Edit" }); this.RenderBreadcrumbTrail(); #region Logging if (log.IsDebugEnabled) log.Debug(Messages.MethodLeave); #endregion }