mirror of
https://github.com/danbulant/discord.js
synced 2026-07-06 03:31:03 +00:00
change role hasPermission to return true for administrator (#525)
* change role hasPermission to return true for administrator rather than manageRoles * add administrator to Role.serialize()
This commit is contained in:
parent
1c7a5abd4e
commit
3e39d54933
2 changed files with 4 additions and 2 deletions
|
|
@ -81,6 +81,7 @@ var Role = (function () {
|
||||||
manageRoles: hp(_Constants.Permissions.manageRoles),
|
manageRoles: hp(_Constants.Permissions.manageRoles),
|
||||||
manageChannels: hp(_Constants.Permissions.manageChannels),
|
manageChannels: hp(_Constants.Permissions.manageChannels),
|
||||||
manageServer: hp(_Constants.Permissions.manageServer),
|
manageServer: hp(_Constants.Permissions.manageServer),
|
||||||
|
administrator: hp(_Constants.Permissions.administrator),
|
||||||
// text
|
// text
|
||||||
readMessages: hp(_Constants.Permissions.readMessages),
|
readMessages: hp(_Constants.Permissions.readMessages),
|
||||||
sendMessages: hp(_Constants.Permissions.sendMessages),
|
sendMessages: hp(_Constants.Permissions.sendMessages),
|
||||||
|
|
@ -116,7 +117,7 @@ var Role = (function () {
|
||||||
}
|
}
|
||||||
if (!explicit) {
|
if (!explicit) {
|
||||||
// implicit permissions allowed
|
// implicit permissions allowed
|
||||||
if (!!(this.permissions & _Constants.Permissions.manageRoles)) {
|
if (!!(this.permissions & _Constants.Permissions.administrator)) {
|
||||||
// manageRoles allowed, they have all permissions
|
// manageRoles allowed, they have all permissions
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ export default class Role {
|
||||||
manageRoles : hp ( Permissions.manageRoles ),
|
manageRoles : hp ( Permissions.manageRoles ),
|
||||||
manageChannels : hp( Permissions.manageChannels ),
|
manageChannels : hp( Permissions.manageChannels ),
|
||||||
manageServer : hp( Permissions.manageServer ),
|
manageServer : hp( Permissions.manageServer ),
|
||||||
|
administrator: hp( Permissions.administrator ),
|
||||||
// text
|
// text
|
||||||
readMessages : hp( Permissions.readMessages ),
|
readMessages : hp( Permissions.readMessages ),
|
||||||
sendMessages : hp( Permissions.sendMessages ),
|
sendMessages : hp( Permissions.sendMessages ),
|
||||||
|
|
@ -102,7 +103,7 @@ export default class Role {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!explicit){ // implicit permissions allowed
|
if(!explicit){ // implicit permissions allowed
|
||||||
if( !!(this.permissions & Permissions.manageRoles) ){
|
if( !!(this.permissions & Permissions.administrator) ){
|
||||||
// manageRoles allowed, they have all permissions
|
// manageRoles allowed, they have all permissions
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue