Update HTTP 401s to 403s to comply with RFC 7231
parent
e67de98eda
commit
64b4eeb0b8
|
@ -23,7 +23,7 @@ export default class Root extends Route {
|
||||||
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
||||||
|
|
||||||
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
||||||
return res.status(401).json({
|
return res.status(403).json({
|
||||||
code: this.constants.codes.UNAUTHORIZED,
|
code: this.constants.codes.UNAUTHORIZED,
|
||||||
message: this.constants.messages.UNAUTHORIZED,
|
message: this.constants.messages.UNAUTHORIZED,
|
||||||
});
|
});
|
||||||
|
@ -77,7 +77,7 @@ export default class Root extends Route {
|
||||||
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
||||||
|
|
||||||
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
||||||
return res.status(401).json({
|
return res.status(403).json({
|
||||||
code: this.constants.codes.UNAUTHORIZED,
|
code: this.constants.codes.UNAUTHORIZED,
|
||||||
message: this.constants.messages.UNAUTHORIZED,
|
message: this.constants.messages.UNAUTHORIZED,
|
||||||
});
|
});
|
||||||
|
@ -137,7 +137,7 @@ export default class Root extends Route {
|
||||||
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
||||||
|
|
||||||
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
||||||
return res.status(401).json({
|
return res.status(403).json({
|
||||||
code: this.constants.codes.UNAUTHORIZED,
|
code: this.constants.codes.UNAUTHORIZED,
|
||||||
message: this.constants.messages.UNAUTHORIZED,
|
message: this.constants.messages.UNAUTHORIZED,
|
||||||
});
|
});
|
||||||
|
@ -191,7 +191,7 @@ export default class Root extends Route {
|
||||||
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
||||||
|
|
||||||
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
||||||
return res.status(401).json({
|
return res.status(403).json({
|
||||||
code: this.constants.codes.UNAUTHORIZED,
|
code: this.constants.codes.UNAUTHORIZED,
|
||||||
message: this.constants.messages.UNAUTHORIZED,
|
message: this.constants.messages.UNAUTHORIZED,
|
||||||
});
|
});
|
||||||
|
@ -203,6 +203,7 @@ export default class Root extends Route {
|
||||||
message: this.constants.messages.CLIENT_ERROR,
|
message: this.constants.messages.CLIENT_ERROR,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(await this.server.client.db.ExecutiveOrder.exists({ oID: req.params.id }))) {
|
if (!(await this.server.client.db.ExecutiveOrder.exists({ oID: req.params.id }))) {
|
||||||
return res.status(404).json({
|
return res.status(404).json({
|
||||||
code: this.constants.codes.NOT_FOUND,
|
code: this.constants.codes.NOT_FOUND,
|
||||||
|
@ -227,7 +228,7 @@ export default class Root extends Route {
|
||||||
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
||||||
|
|
||||||
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
||||||
return res.status(401).json({
|
return res.status(403).json({
|
||||||
code: this.constants.codes.UNAUTHORIZED,
|
code: this.constants.codes.UNAUTHORIZED,
|
||||||
message: this.constants.messages.UNAUTHORIZED,
|
message: this.constants.messages.UNAUTHORIZED,
|
||||||
});
|
});
|
||||||
|
@ -263,7 +264,7 @@ export default class Root extends Route {
|
||||||
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
||||||
|
|
||||||
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
||||||
return res.status(401).json({
|
return res.status(403).json({
|
||||||
code: this.constants.codes.UNAUTHORIZED,
|
code: this.constants.codes.UNAUTHORIZED,
|
||||||
message: this.constants.messages.UNAUTHORIZED,
|
message: this.constants.messages.UNAUTHORIZED,
|
||||||
});
|
});
|
||||||
|
@ -376,7 +377,7 @@ export default class Root extends Route {
|
||||||
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
||||||
|
|
||||||
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
||||||
return res.status(401).json({
|
return res.status(403).json({
|
||||||
code: this.constants.codes.UNAUTHORIZED,
|
code: this.constants.codes.UNAUTHORIZED,
|
||||||
message: this.constants.messages.UNAUTHORIZED,
|
message: this.constants.messages.UNAUTHORIZED,
|
||||||
});
|
});
|
||||||
|
@ -422,7 +423,7 @@ export default class Root extends Route {
|
||||||
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
||||||
|
|
||||||
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
||||||
return res.status(401).json({
|
return res.status(403).json({
|
||||||
code: this.constants.codes.UNAUTHORIZED,
|
code: this.constants.codes.UNAUTHORIZED,
|
||||||
message: this.constants.messages.UNAUTHORIZED,
|
message: this.constants.messages.UNAUTHORIZED,
|
||||||
});
|
});
|
||||||
|
@ -468,7 +469,7 @@ export default class Root extends Route {
|
||||||
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
const staffGuild = this.server.client.guilds.get('446067825673633794') || await this.server.client.getRESTGuild('446067825673633794');
|
||||||
|
|
||||||
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
if (!director || !staffGuild.members.get(director.userID)?.roles?.includes('662163685439045632')) {
|
||||||
return res.status(401).json({
|
return res.status(403).json({
|
||||||
code: this.constants.codes.UNAUTHORIZED,
|
code: this.constants.codes.UNAUTHORIZED,
|
||||||
message: this.constants.messages.UNAUTHORIZED,
|
message: this.constants.messages.UNAUTHORIZED,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue