Пример #1
0
 public PermissionModuleCodeDTO(PermissionModuleCode permissionModuleCode)
 {
     this.Id         = permissionModuleCode.Id;
     this.CreateDate = permissionModuleCode.CreateDate;
     this.Name       = permissionModuleCode.Name;
     this.Code       = permissionModuleCode.Code;
     this.ModuleName = permissionModuleCode.PermissionModule.Name;
 }
Пример #2
0
        public ActionResult PermissionModuleCodeDeleteProvide(Guid id)
        {
            if (!base.HasPermission("permission", PermissionOperate.delete))
            {
                return(JsonMessage(false, "你没有删除权限的权限"));
            }

            PermissionModuleCode permissionModuleCode = _permissionModuleCodeService.GetById(id);

            _permissionModuleCodeService.Delete(id.ToString());
            AdminPermissionsCache.Instance.RemoveCache();
            base.AddLog(string.Format("删除权限[{0}]成功", permissionModuleCode.Name), AdminLoggerModuleEnum.Permission);
            return(JsonMessage(true, "删除成功"));
        }
Пример #3
0
        public ActionResult PermissionModuleCodeEditProvide()
        {
            string permissionModuleId     = RQuery["PermissionModuleId"];
            string permissionModuleCodeId = RQuery["PermissionModuleCodeId"];

            if (string.IsNullOrWhiteSpace(permissionModuleCodeId))
            {
                if (!base.HasPermission("permission", PermissionOperate.add))
                {
                    return(JsonMessage(false, "你没有添加权限的权限"));
                }
            }
            else
            {
                if (!base.HasPermission("permission", PermissionOperate.edit))
                {
                    return(JsonMessage(false, "你没有编辑权限的权限"));
                }
            }

            if (string.IsNullOrWhiteSpace(permissionModuleCodeId))
            {
                PermissionModuleCode permissionModuleCode = new PermissionModuleCode();
                UpdateModel <PermissionModuleCode>(permissionModuleCode);
                _permissionModuleCodeService.Insert(permissionModuleCode);
                AdminPermissionsCache.Instance.RemoveCache();
                base.AddLog(string.Format("添加权限[{0}]成功", permissionModuleCode.Name), AdminLoggerModuleEnum.Permission);
                return(JsonMessage(true, "添加权限成功"));
            }
            else
            {
                PermissionModuleCode permissionModuleCode = _permissionModuleCodeService.GetById(new Guid(permissionModuleCodeId));
                UpdateModel <PermissionModuleCode>(permissionModuleCode);
                _permissionModuleCodeService.Update(permissionModuleCode);
                AdminPermissionsCache.Instance.RemoveCache();
                base.AddLog(string.Format("修改权限[{0}]成功", permissionModuleCode.Name), AdminLoggerModuleEnum.Permission);
                return(JsonMessage(true, "修改权限成功"));
            }
        }
Пример #4
0
        public ActionResult PermissionModuleCodeEdit()
        {
            if (!base.HasPermission("permission", PermissionOperate.add) && !base.HasPermission("permission", PermissionOperate.edit))
            {
                return(base.ShowNotPermissionTip(""));
            }

            if (!string.IsNullOrWhiteSpace(RQuery["PermissionModuleId"]))
            {
                PermissionModule permissionModule = _permissionModuleService.GetById(new Guid(RQuery["PermissionModuleId"]));
                ViewBag.PermissionModule = permissionModule;
            }

            string id = RQuery["Id"];
            PermissionModuleCode permissionModuleCode = string.IsNullOrWhiteSpace(id) ? null : _permissionModuleCodeService.GetById(new Guid(id));

            if (permissionModuleCode != null)
            {
                ViewBag.PermissionModule = permissionModuleCode.PermissionModule;
            }

            return(AdminView(permissionModuleCode));
        }