Skip to content

Commit

Permalink
Improve permission check
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Nov 2, 2022
1 parent 87d5432 commit d5ac6aa
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void checkEdit(long userId, Class<?> clazz, boolean addition) throws Stor
} else if (clazz.equals(Device.class)) {
denied = getServer().getDeviceReadonly() || getUser(userId).getDeviceReadonly()
|| addition && getUser(userId).getDeviceLimit() == 0;
if (addition && getUser(userId).getDeviceLimit() > 0) {
if (!denied && addition && getUser(userId).getDeviceLimit() > 0) {
int deviceCount = storage.getObjects(Device.class, new Request(
new Columns.Include("id"),
new Condition.Permission(User.class, userId, Device.class))).size();
Expand Down

0 comments on commit d5ac6aa

Please sign in to comment.