mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01: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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user