/// <summary> /// 删除角色 /// </summary> /// <param name="role"></param> public static void RemoveRole(Neusoft.HISFC.BizLogic.Privilege.Model.Role role) { //using (DaoManager daoMgr = new DaoManager()) //{ try { RoleLogic roleLogic = new RoleLogic(); //daoMgr.BeginTransaction(); //删除角色信息表 roleLogic.Delete(role.ID); //删除角色权限对应表 RoleResourceProcess roleRes = new RoleResourceProcess(); List <RoleResourceMapping> roleResList = roleRes.QueryByRole(role.ID); roleRes.DeleteRoleResource(roleResList); //删除角色授权信息 AuthorityLogic authorityLogic = new AuthorityLogic(); authorityLogic.DeleteRole(role.ID); //daoMgr.CommitTransaction(); } catch { //daoMgr.RollBackTransaction(); throw; } //} }
/// <summary> /// 撤销权限 /// </summary> /// <param name="ResourceType"></param> /// <param name="role"></param> /// <param name="resource"></param> /// <returns></returns> public int Revoke(string ResourceType, Neusoft.HISFC.BizLogic.Privilege.Model.Role role, Neusoft.HISFC.BizLogic.Privilege.Model.Priv resource) { // LoadPermissionProvider(); PermissionFactory.LoadPermissionProvider(); ResourceType _resType = GetResourceTypeByID(ResourceType); if (_resType == null) { throw new Exception("没有类型为:" + ResourceType + "的资源!"); } return(GetPermissionProviderByResType(_resType).Revoke(role, resource)); }
/// <summary> /// 保存角色 /// </summary> /// <param name="role"></param> /// <param name="newUsersId"></param> /// <returns></returns> public Neusoft.HISFC.BizLogic.Privilege.Model.Role SaveRole(Neusoft.HISFC.BizLogic.Privilege.Model.Role role, IList <string> newUsersId) { SecurityService ss = new SecurityService(); return(ss.SaveRole(role, newUsersId)); }