Skip to content

Commit

Permalink
fix permission functions
Browse files Browse the repository at this point in the history
  • Loading branch information
143mailliw committed Apr 10, 2021
1 parent dadc8dc commit db1f9df
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/util/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function checkReadPermission(user: IUser, planet: IPlanet): boolean {
return true;
}

if(planet.members && planet.members.includes({id: user.id, username: user.username})) {
if(planet.members && planet.members.some(e => e.id === user.id)) {
return true;
}

Expand All @@ -35,15 +35,15 @@ function checkPublicWritePermission(user: IUser, planet: IPlanet): boolean {
return true;
}

if(planet.banned && planet.banned.includes({id: user.id})) {
if(planet.banned && planet.banned.some(e => e.id === user.id)) {
return false;
}

if(!planet.private) {
return true;
}

if(planet.members && planet.members.includes({id: user.id})) {
if(planet.members && planet.members.some(e => e.id === user.id)) {
return true;
}

Expand All @@ -67,11 +67,11 @@ function checkFullWritePermission(user: IUser, planet: IPlanet): boolean {
return true;
}

if(planet.banned && planet.banned.includes({id: user.id})) {
if(planet.banned && planet.banned.some(e => e.id === user.id)) {
return false;
}

if(planet.members && planet.members.includes({id: user.id})) {
if(planet.members && planet.members.some(e => e.id === user.id)) {
return true;
}

Expand Down

0 comments on commit db1f9df

Please sign in to comment.