苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 3502|回复: 1

[其他] 根据用户角色判断显示导航

[复制链接]
发表于 2013-6-21 09:55:58 | 显示全部楼层 |阅读模式
数据库角色表
TM截图20130621094822.jpg

用户表

权限表
00.jpg

导航前台 11.jpg


后台代码
public partial class Left : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
BindPurview();
}

private void BindPurview()
{
Model.Purview purview = ((User)Session["user"]).UserRole.RolePurview;
liItemFlow.Visible = purview.ItemFlow;
liAddItemFlow.Visible = purview.AddItemFlow;
liItemFlowManage.Visible = purview.ItemFlowManage;
liAllotItemFlowManage.Visible = purview.AllotItemFlowManage;

liSupervise.Visible = purview.Supervise;
liPutAuditFlowManage.Visible = purview.PutAuditFlowManage;
liItemFlowManage.Visible = purview.ItemFlowManage;

liChecks.Visible = purview.Checks;
liCheck.Visible = purview.Check;
liAddCompany.Visible = purview.AddCompany;
//liReportManage.Visible = purview.ReportManage;
liCheckManHoerManage.Visible = purview.CheckManHoerManage;
liInvoiceAudit.Visible = purview.InvoiceAuditManage;

liWork.Visible = purview.Work;
liInvoiceManage.Visible = purview.InvoiceManage;
liFileManage.Visible = purview.FileManage;

liInvoiceUserManage.Visible = purview.InvoiceUserManage;
liManHourManage.Visible = purview.ManHourManage;

liCost.Visible = purview.Cost;
liCosting.Visible = purview.Costing;
liOutputInvoiceManage.Visible = purview.OutputInvoiceManage;

liSystemManage.Visible = purview.SystemManage;
liAddStaff.Visible = purview.AddStaff;
liSearchLog.Visible = purview.SearchLog;


if (((User)Session["user"]).Department.IndexOf("审计")!=-1)
{
if (!((User)Session["user"]).Department.Equals("审计三部"))
{
liAddItemFlow.Visible = false;
}
}

用户权限类
/// <summary>
/// ClassNameurview
/// Version:1.0
/// DateTime:2009/8/12
/// Remark:实体层-角色权限类
/// </summary>
public class Purview
{
public Purview(String limit)
{
this.limit = limit.ToCharArray();
}

/// <summary>
/// 用户权限字符串
/// </summary>
private char[] limit = new char[27];

/// <summary>
/// 用户权限字符串
/// </summary>
public string Limit
{
get { return limit.ToString(); }
set { limit = value.ToCharArray(); }
}

/// <summary>
/// 重构ToString方法
/// </summary>
/// <returns></returns>
public override string ToString()
{
return limit.ToString();
}

/// <summary>
/// 1派单管理(菜单)
/// </summary>
public bool ItemFlow
{
get { return limit[0] == '1'; }
set { limit[0] = value ? '1' : '0'; }
}


/// <summary>
/// 2派单维护
/// </summary>
public bool ItemFlowManage
{
get { return limit[1] == '1'; }
set { limit[1] = value ? '1' : '0'; }
}

/// <summary>
/// 3添加派单
/// </summary>
public bool AddItemFlow
{
get { return limit[2] == '1'; }
set { limit[2] = value ? '1' : '0'; }
}

/// <summary>
/// 4项目管理(菜单)
/// </summary>
public bool Supervise
{
get { return limit[3] == '1'; }
set { limit[3] = value ? '1' : '0'; }
}

/// <summary>
/// 5项目负责人取号
/// </summary>
public bool AllotItemFlowManage
{
get { return limit[4] == '1'; }
set { limit[4] = value ? '1' : '0'; }
}

/// <summary>
/// 6取号管理
/// </summary>
public bool ReportManage
{
get { return limit[5] == '1'; }
set { limit[5] = value ? '1' : '0'; }
}

/// <summary>
/// 7报告数据
/// </summary>
public bool AuditFlowManage
{
get { return limit[6] == '1'; }
set { limit[6] = value ? '1' : '0'; }
}

/// <summary>
/// 8项目审核(菜单)
/// </summary>
public bool Checks
{
get { return limit[7] == '1'; }
set { limit[7] = value ? '1' : '0'; }
}

/// <summary>
/// 9三级复核
/// </summary>
public bool Check
{
get { return limit[8] == '1'; }
set { limit[8] = value ? '1' : '0'; }
}

/// <summary>
/// 10办公管理(菜单)
/// </summary>
public bool Work
{
get { return limit[9] == '1'; }
set { limit[9] = value ? '1' : '0'; }
}

/// <summary>
/// 11数据报备
/// </summary>
public bool PutAuditFlowManage
{
get { return limit[10] == '1'; }
set { limit[10] = value ? '1' : '0'; }
}

/// <summary>
/// 12工时填报
/// </summary>
public bool ManHourManage
{
get { return limit[11] == '1'; }
set { limit[11] = value ? '1' : '0'; }
}


/// <summary>
/// 13工时审核
/// </summary>
public bool CheckManHoerManage

{
get { return limit[12] == '1'; }
set { limit[12] = value ? '1' : '0'; }
}


/// <summary>
/// 14发票审核
/// </summary>
public bool InvoiceAuditManage
{
get { return limit[13] == '1'; }
set { limit[13] = value ? '1' : '0'; }
}

/// <summary>
/// 15档案借阅
/// </summary>
public bool FileManage
{
get { return limit[14] == '1'; }
set { limit[14] = value ? '1' : '0'; }
}

/// <summary>
/// 16开具发票
/// </summary>
public bool InvoiceManage
{
get { return limit[15] == '1'; }
set { limit[15] = value ? '1' : '0'; }
}

/// <summary>
/// 17发票管理
/// </summary>
public bool InvoiceUserManage
{
get { return limit[16] == '1'; }
set { limit[16] = value ? '1' : '0'; }
}

/// <summary>
/// 18增加单位
/// </summary>
public bool AddCompany
{
get { return limit[17] == '1'; }
set { limit[17] = value ? '1' : '0'; }
}

/// <summary>
///
/// </summary>
public bool Cost
{
get { return limit[18] == '1'; }
set { limit[18] = value ? '1' : '0'; }
}

/// <summary>
/// 发票导出
/// </summary>
public bool OutputInvoiceManage
{
get { return limit[19] == '1'; }
set { limit[19] = value ? '1' : '0'; }
}

/// <summary>
///
/// </summary>
public bool Costing
{
get { return limit[20] == '1'; }
set { limit[20] = value ? '1' : '0'; }
}

/// <summary>
/// 系统维护(菜单)
/// </summary>
public bool SystemManage
{
get { return limit[21] == '1'; }
set { limit[21] = value ? '1' : '0'; }
}

/// <summary>
/// 员工维护
/// </summary>
public bool StaffManage
{
get { return limit[22] == '1'; }
set { limit[22] = value ? '1' : '0'; }
}

/// <summary>
/// 添加员工
/// </summary>
public bool AddStaff
{
get { return limit[23] == '1'; }
set { limit[23] = value ? '1' : '0'; }
}

public bool SearchLog
{
get { return limit[24] == '1'; }
set { limit[24] = value ? '1' : '0'; }
}

/// <summary>
/// 权限设置
/// </summary>
public bool PurviewOpera
{
get { return limit[25] == '1'; }
set { limit[25] = value ? '1' : '0'; }
}

/// <summary>
/// 维护时间设置
/// </summary>
public bool SysMaintenance
{
get { return limit[26] == '1'; }
set { limit[26] = value ? '1' : '0'; }
}
}
}

请问在哪可以修改用户显示导航,现在想添加一个链接 就不知道怎么显示跟权限控制



1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2013-6-21 10:00:30 | 显示全部楼层
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-12-26 15:16

© 2014-2021

快速回复 返回顶部 返回列表