adds support for role settings and various fixes
This commit is contained in:
parent
96b2dbb21c
commit
8fe0c9f46b
20 changed files with 1199 additions and 183 deletions
|
@ -2,7 +2,9 @@ export {Permissions};
|
|||
class Permissions{
|
||||
allow:bigint;
|
||||
deny:bigint;
|
||||
readonly hasDeny:boolean;
|
||||
constructor(allow:string,deny:string=""){
|
||||
this.hasDeny=!!deny;
|
||||
this.allow=BigInt(allow);
|
||||
this.deny=BigInt(deny);
|
||||
}
|
||||
|
@ -86,7 +88,7 @@ class Permissions{
|
|||
},
|
||||
{
|
||||
name:"MANAGE_MESSAGES",
|
||||
readableName:"Manager messages",
|
||||
readableName:"Manage messages",
|
||||
description:"Allows the user to delete messages that aren't their own"
|
||||
},
|
||||
{
|
||||
|
@ -242,5 +244,22 @@ class Permissions{
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
setPermision(name:string,setto:number):void{
|
||||
const bit=Permissions.map[name] as number;
|
||||
if(setto===0){
|
||||
this.deny=this.setPermisionbit(bit,false,this.deny);
|
||||
this.allow=this.setPermisionbit(bit,false,this.allow);
|
||||
}else if(setto===1){
|
||||
|
||||
this.deny=this.setPermisionbit(bit,false,this.deny);
|
||||
this.allow=this.setPermisionbit(bit,true,this.allow);
|
||||
}else if(setto===-1){
|
||||
|
||||
this.deny=this.setPermisionbit(bit,true,this.deny);
|
||||
this.allow=this.setPermisionbit(bit,false,this.allow);
|
||||
}else{
|
||||
console.error("invalid number entered:"+setto);
|
||||
}
|
||||
}
|
||||
}
|
||||
Permissions.makeMap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue