コード例 #1
0
        // **************************************
        // URL: /UserManagement/User/5
        // **************************************
        public virtual ActionResult Detail(int id)
        {
            try {
                var user = UserManagementService.GetUserDetail(id);
                var vm = new UserViewModel();
                var activeUser = Account.User();

                vm.MyUsers = new List<User>() { user };
                vm.Catalogs = activeUser.IsSuperAdmin() ? CacheService.Catalogs() : activeUser.MyAdminCatalogs();
                vm.Roles = ModelEnums.GetRoles().Where(r => r >= activeUser.RoleId).ToArray();

                vm.CatalogRoles = activeUser.MyAssignableRoles();
                vm.IsThisUser = user.UserId == activeUser.UserId;
                vm.NavigationLocation = new string[] { "Admin" };
                vm.AllowEdit = !vm.IsThisUser && !user.IsSuperAdmin();

                UserEventLogService.LogUserEvent(UserActions.ViewUserDetail);

                if (Request.IsAjaxRequest()) {
                    return View(Views.ctrlDetail, vm);
                } else {
                    return View(Views.ctrlDetail, vm); //RedirectToAction(Actions.Index()); //return View(vm);
                }
            }
            catch (Exception ex){
                Log.Error(ex);

                if (Request.IsAjaxRequest()) {
                    throw ex;
                } else {
                    this.FeedbackError("There was an error processing your request");
                    return RedirectToAction(Actions.Index());
                }
            }
        }
コード例 #2
0
        // **************************************
        // URL: /UserManagement/
        // **************************************
        public virtual ActionResult Index()
        {
            try {
                var users = Account.User().MyUserHierarchy();
                var invites = UserManagementService.GetMyInvites(InvitationStatusCodes.Open);
                var vm = new UserViewModel();

                vm.MyUsers = users;
                vm.MyInvites = invites;
                vm.PageTitle = "User Management";
                vm.NavigationLocation = new string[] { "Admin" };

                return View(vm);
            }
            catch (Exception ex) {
                Log.Error(ex);

                this.FeedbackError("There was an error loading the User Management page. Please try again in a bit.");
                return RedirectToAction(MVC.Home.Index());
            }
        }