Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only log if the permission is changed #605

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

kickster97
Copy link
Member

@kickster97 kickster97 commented Dec 5, 2023

WHAT is this pull request doing?

Don't log thet the permission is updated if the permission is the same that we already have.
I tried opting for an early return.. but it looks like we do this on launch, and if we don't have a default user we can't create one.

Oskar also gave his two cents, and makes the case that we could change these permissions updates in ssh-monitor.. and hat we should log because we do the update.

HOW can this pull request be tested?

try to update permissions without changing them

Copy link
Member

@viktorerlingsson viktorerlingsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Maybe we could also move these rows inside the unless? If the permissions are the same there shouldn't be a need to update and save them.

@users[user].permissions[vhost] = perm
@users[user].invalidate_acl_caches
save!

@kickster97
Copy link
Member Author

kickster97 commented Dec 7, 2023

Looks good to me.

Maybe we could also move these rows inside the unless? If the permissions are the same there shouldn't be a need to update and save them.

@users[user].permissions[vhost] = perm
@users[user].invalidate_acl_caches
save!

I tried this, but if we don't have a user this wont work.. and its run at launch when we don't have one yet so then it fails :)

@viktorerlingsson
Copy link
Member

I tried this, but if we don't have a user this wont work.. and its run at launch when we don't have one yet so then it fails :)

Okay!

@kickster97 kickster97 merged commit 575c39c into main Dec 11, 2023
14 of 26 checks passed
@kickster97 kickster97 deleted the dont_log_redundant_permission_update branch December 11, 2023 07:24
kickster97 added a commit that referenced this pull request Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants