The invention discloses a method and device for authority control, which relates to the technical field of role management of web system. In order to solve the problems of poor role scalability and insufficient control granularity of existing authority control modes. The method of the invention includes: obtaining the user's corresponding identity after the user logs into the web system; traversing all the page tags, selecting the page tag with the authority control attribute to determine the target tag; parsing the authority control attribute of the target tag, obtaining the value of the sub-attribute contained in the authority control attribute, and at least including the product identification and resources corresponding to the page tag. Code and action code; compare the value of sub-attribute corresponding to identity with the value of sub-attribute contained in the permission control attribute of the target tag; set the display attribute of the target tag according to the result of the comparison to realize the permission control of the page tag. The invention is suitable for application in the process of Web front-end authority control.
【技术实现步骤摘要】
权限控制的方法及装置
本专利技术涉及web系统角色管理
,尤其涉及一种权限控制的方法及装置。
技术介绍
在大中型的web前端系统中,通常都需要进行用户的权限控制。对用户的权限控制可以使用基于角色的权限控制,具体是根据用户的身份信息,将用户分为不同的角色,不同的角色分配不同的资源,进而进行不同的角色授权。现有用户的权限控制技术,通常是设定一个系统分为几种固定的角色,根据不同的角色,在数据库设计中分配不同的角色值,当用户登陆后,在数据库中获取所有的角色值分别对比该用户对应的值,然后将用户与某一种角色相对应,并根据该角色对应的值将相对应的元素展示给当前用户。对于上述用户的权限控制方式,可以看出权限控制涉及角色管理不足,只能为用户选择设定的固定角色,无法满足更多角色的权限控制的需求;另外,现有用户的权限控制方式通常只细化到页面层级以及模块层级,无法满足对于更细的层级(比如一个按钮等)的权限的控制。
技术实现思路
鉴于上述问题,本专利技术提供一种权限控制的方法及装置,为了解决现有的权限控制方式角色可扩展性差,控制粒度不够细的问题。为解决上述技术问题,第一方面,本专利技术提供了一种权限控制的方法,该方法包括:获取用户对应的身份标识;遍历所有的页面标签,选取具有权限控制属性的页面标签确定为目标标签;解析所述目标标签的权限控制属性,获取权限控制属性包含的子属性的值,所述子属性至少包含页面标签对应的产品标识、资源码以及动作码;将所述身份标识对应的子属性的值与所述目标标签权限控制属性包含的子属性的值进行比对;根据比对结果对所述目标标签的展示属性进行设置,以实现页面标签的权限 ...
【技术保护点】
1.一种权限控制的方法,其特征在于,所述方法包括:获取用户对应的身份标识;遍历所有的页面标签,选取具有权限控制属性的页面标签确定为目标标签;解析所述目标标签的权限控制属性,获取权限控制属性包含的子属性的值,所述子属性至少包含页面标签对应的产品标识、资源码以及动作码;将所述身份标识对应的子属性的值与所述目标标签权限控制属性包含的子属性的值进行比对;根据比对结果对所述目标标签的展示属性进行设置,以实现页面标签的权限控制。
【技术特征摘要】
1.一种权限控制的方法,其特征在于,所述方法包括:获取用户对应的身份标识;遍历所有的页面标签,选取具有权限控制属性的页面标签确定为目标标签;解析所述目标标签的权限控制属性,获取权限控制属性包含的子属性的值,所述子属性至少包含页面标签对应的产品标识、资源码以及动作码;将所述身份标识对应的子属性的值与所述目标标签权限控制属性包含的子属性的值进行比对;根据比对结果对所述目标标签的展示属性进行设置,以实现页面标签的权限控制。2.根据权利要求1所述的方法,其特征在于,在遍历所有的页面标签,选取具有权限控制属性的页面标签确定为目标标签之前,所述方法还包括:为需要进行权限控制的页面标签添加权限控制属性及其所包含的子属性的值。3.根据权利要求2所述的方法,其特征在于,所述为需要进行权限控制的页面标签的权限控制属性添加所包含的子属性的值包括:以angular指令的方式为需要进行权限控制的页面标签的权限控制属性所包含的子属性进行传值。4.根据权利要求1-3任一项所述的方法,其特征在于,在将所述身份标识对应的子属性的值与所述目标标签权限控制属性包含的子属性的值进行比对之前,所述方法还包括:设置用户对应的身份标识所对应的子属性的值。5.根据权利要求1-4任一项所述的方法,其特征在于,所述根据比对结果对所述目标标签的展示属性进行设置,包括:将存在相同的子属性的值对应的目标标签的展示属性设置为显示;将不存在相同的...
【专利技术属性】
技术研发人员:杜志娟,
申请(专利权)人:北京国双科技有限公司,
类型:发明
国别省市:北京,11
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。