예제 #1
0
        public ActionResult Index()
        {
            AccessRolesViewModel model = new AccessRolesViewModel();
            string roleId = null;

            if (Request["RoleId"] != null)
            {
                roleId = Request["RoleId"];
            }

            try
            {
                model.AllRoles      = new RoleRepository(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString).GetAll().OrderBy(m => m.Name).ToList();
                model.AllOperations = _identityStore.GetAllOperations();

                if (!string.IsNullOrEmpty(roleId))
                {
                    //List access by role
                    //model.AccessList = _identityStore.GetAccessByRoleId(roleId);
                    //model.AccessList = _identityStore.GetAccessByRoleId(roleId);
                    //if (model.AccessList != null && model.AccessList.Count > 0)
                    //{
                    //    foreach (var acc in model.AccessList)
                    //    {
                    //        acc.OperationsList = _identityStore.GetOperationsByAccessId(acc.AccessId).ToList();
                    //    }
                    //}

                    model.RoleId          = roleId;
                    model.PermissionsList = _identityStore.GetPermissionByRoleId(roleId);

                    //All access
                    model.AllAccess = _identityStore.GetAllAccess();
                    if (model.AllAccess != null && model.AllAccess.Count > 0)
                    {
                        foreach (var acc in model.AllAccess)
                        {
                            acc.OperationsList = _identityStore.GetOperationsByAccessId(acc.Id).ToList();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.AddNotification("Failed to get data: " + ex.ToString(), NotificationType.ERROR);
                return(View(model));
            }

            return(View(model));
        }
예제 #2
0
        public ActionResult Index(AccessViewModel model)
        {
            var strError = string.Empty;

            try
            {
                model.AllAccess = _identityStore.GetAllAccess();
            }
            catch (Exception ex)
            {
                strError = string.Format("Could not GetAllAccess because: {0}", ex.ToString());
                logger.Error(strError);
                this.AddNotification(strError, NotificationType.ERROR);
            }

            model.AllControllers = Constant.GetAllControllers(Server.MapPath("~/Controllers"));
            return(View(model));
        }
예제 #3
0
        public ActionResult Index(FunctionViewModel model)
        {
            ModelState.Clear();
            var strError = string.Empty;

            try
            {
                model.AllAccesses   = _identityStore.GetAllAccess();
                model.AllOperations = _identityStore.GetAllOperations();
            }
            catch (Exception ex)
            {
                strError = string.Format("Could not GetAllAccess because: {0}", ex.ToString());
                logger.Error(strError);
                this.AddNotification(strError, NotificationType.ERROR);
            }

            return(View(model));
        }