public void Default(int applicationId)
        {
            #region Logging
            if (log.IsDebugEnabled) log.Debug(Messages.MethodEnter);
            #endregion
            Application application = new ApplicationSvc().Get(applicationId);

            ApplicationUserCollection users = new ApplicationUserSvc().Get(application);
            this.PropertyBag["users"] = users;

            #region Logging
            if (log.IsDebugEnabled) log.Debug(Messages.MethodLeave);
            #endregion
        }
        /// <summary>
        /// Displays the edit view of the project with a specified id.
        /// </summary>
        /// <param name="id">The id of the project.</param>
        public void ConfirmDelete(int roleId)
        {
            #region Logging
            if (log.IsDebugEnabled) log.Debug(Messages.MethodEnter);
            #endregion

            Role role = new RoleSvc().Get(roleId);
            Application application = new ApplicationSvc().Get(role.Application.Id);

            this.PropertyBag["role"] = role;

            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 = "Delete" });
            this.RenderBreadcrumbTrail();

            this.RenderView("delete");

            #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
        }
 public ApplicationServiceTests()
 {
     _fixture        = new MockRepositorySpecification();
     _applicationSvc = new ApplicationSvc(_fixture.Repository, () => _fixture.GetListener(nameof(ApplicationServiceTests)), _fixture.Dispatcher);
 }