Cooperate with the backend to achieve the most efficient permission assignment through AND or

Cooperate with the backend to achieve the most efficient permission assignment through AND or

const inerst = 0b001 //插入权限
const updata = 0b010 //更新
const remove = 0b100 //删除
const uselimit = inerst|updata
console.log(Boolean(limit & remove)); //false,use没有分配到删除权限,删除按钮禁用(不显示)

Actively remove a certain permission from a role

const inerst = 0b001 //插入权限
const updata = 0b010 //更新
const remove = 0b100 //删除
const limit = inerst|updata|remove
const new_limit = limit ^ remove //主动剔除remove权限
console.log(Boolean(new_limit & remove)); //false

Guess you like

Origin blog.csdn.net/m0_46672781/article/details/127726749