Skip to content

Commit

Permalink
Return early if permissions is unchanged (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
kickster97 authored Dec 11, 2023
1 parent d8553d4 commit fad6f2d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lavinmq/user_store.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ module LavinMQ

def add_permission(user, vhost, config, read, write)
perm = {config: config, read: read, write: write}
if @users[user].permissions[vhost]? && @users[user].permissions[vhost] == perm
return perm
end
@users[user].permissions[vhost] = perm
@users[user].invalidate_acl_caches
Log.info { "Updated permissions for user=#{user} on vhost=#{vhost}" }
save!
perm
end
Expand Down

0 comments on commit fad6f2d

Please sign in to comment.