-
-
Notifications
You must be signed in to change notification settings - Fork 409
Enhance PostgreSQL role management by adding ALTER ROLE support #1318
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
Conversation
Updated the role function to yield SQL commands for altering existing PostgreSQL roles, allowing modifications to attributes such as LOGIN, SUPERUSER, and CONNECTION LIMIT. Changed the parameter name for sudo_user to _sudo_user for consistency.
…ing role update test Deleted the role_add_noop.json file as it was no longer needed. Introduced role_update.json to test the ALTER ROLE functionality, including connection limit and password updates for the 'testuser' role.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, it'd be nice to not make every postgres.role
operation execute a command every time, could we check the existing role to see if ALTER
is needed?
I think if a password is set we'll always need to alter because we can't check those, but all the other arguments should be the relevant info on the roles fact.
Correct, I will work on it |
Updated the role function to check if any attributes (LOGIN, SUPERUSER, INHERIT, CREATEDB, CREATEROLE, CONNECTION LIMIT, PASSWORD) need to be altered before executing the SQL command. Added a new test case to verify the no-op behavior when the role already exists with the specified attributes.
… function Updated the docstring in opkg.py for clarity and formatting. Enhanced type hints in the role function of postgres.py to explicitly define parameter types, improving code readability and type safety.
@Fizzadar I fixed it but we need to fix the actions |
@Fizzadar ready to be merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks @wowi42!
Updated the role function to yield SQL commands for altering existing PostgreSQL roles, allowing modifications to attributes such as LOGIN, SUPERUSER, and CONNECTION LIMIT. Changed the parameter name for sudo_user to _sudo_user for consistency.