Commit graph

23 commits

Author SHA1 Message Date
Greg DeKoenigsberg
57dcf2c9dd @lorin stepping down as maintainer 2015-10-28 14:38:11 -04:00
Will Thames
47cb92f74f Ensure TEMP privilege gets removed when expanding ALL.
ALL gets expanded to the list of VALID_PRIVS which includes
TEMPORARY and TEMP
The code that replaced TEMP with TEMPORARY didn't work with the
expansion
2015-07-22 13:34:52 +10:00
Will Thames
2a0f6c1cb3 Correct handling of empty role_attr_flags
role_attr_flags is the empty string by default, not None.
2015-07-22 12:05:21 +10:00
Greg DeKoenigsberg
2a5f0bde87 Proper author info for all remaining modules 2015-06-15 15:53:30 -04:00
Toshio Kuratomi
c700993dd5 Fix a problem introduced with #1101 and optimize privilege handling
* If a db user belonged to a role which had a privilege, the user would
  not have the privilege added as the role gave the appearance that the
  user already had it.  Fixed to always check the privileges specific to
  the user.
* Make fewer db queries to determine if privileges need to be changed
  and change them (was four for each privilege.  Now two for each object
  that has a set of privileges changed).
2015-06-01 15:59:26 -07:00
Will Thames
167e7c2b81 Perform privilege grants/revokes only when required
Use `has_table_privileges` and `has_database_privileges`
to test whether a user already has a privilege before
granting it, or whether a user doesn't have  a privilege
before revoking it.
2015-06-01 15:15:22 -07:00
Toshio Kuratomi
c9b17136e4 Fix a problem introduced with #1101 and optimize privilege handling
* If a db user belonged to a role which had a privilege, the user would
  not have the privilege added as the role gave the appearance that the
  user already had it.  Fixed to always check the privileges specific to
  the user.
* Make fewer db queries to determine if privileges need to be changed
  and change them (was four for each privilege.  Now two for each object
  that has a set of privileges changed).
2015-05-19 12:57:06 -07:00
Toshio Kuratomi
7dd9f57e16 Fix splitting of role_attrs 2015-05-18 12:45:47 -07:00
Will Thames
c956c65731 Usage is not a valid database or table privilege
Remove `USAGE` from the `VALID_PRIVS` dict for both database and
table because it is not a valid privilege for either (and
breaks the implementation of `has_table_privilege` and
`has_database_privilege`

See http://www.postgresql.org/docs/9.0/static/sql-grant.html
2015-04-08 13:00:50 +10:00
Will Thames
7d66da35a7 Perform privilege grants/revokes only when required
Use `has_table_privileges` and `has_database_privileges`
to test whether a user already has a privilege before
granting it, or whether a user doesn't have  a privilege
before revoking it.
2015-04-08 12:48:45 +10:00
Will Thames
b4515c8909 Update postgresql users only when necessary
For read-only databases, users should not change when no changes
are required.

Don't issue ALTER ROLE when role attribute flags, users password
or expiry time is not changing.

In certain cases (hashed passwords in the DB, but the password
argument is not hashed) passlib.hash is required to avoid
running ALTER ROLE.
2015-04-08 11:17:11 +10:00
tedder
bffd137edd code review fixes per #957 2015-03-30 15:51:54 -07:00
tedder
472331a53b skip password changes so pg_authid isn't needed
Some places ([AWS RDS](https://forums.aws.amazon.com/thread.jspa?threadID=151248)) don't have, or don't allow, access to the `pg_authid` table. The only reason that is necessary is to check for a password change.

This flag is a workaround so passwords can only be set at creation time. It isn't as elegant as changing the password down the line, but it fixes the longstanding issue #297 that prevented this from being useful on AWS RDS.
2015-03-30 13:35:54 -07:00
Toshio Kuratomi
b766390ae2 Add USAGE as a valid privilege 2014-12-03 14:43:20 -08:00
Toshio Kuratomi
5af4463823 Gixes to doc formatting 2014-12-03 08:17:15 -08:00
Dan
3a3ff1f0e4 Adds a unix_socket/login_unix_socket option to the postgresql_user module. 2014-12-01 12:23:33 -05:00
Toshio Kuratomi
2a794fa776 Fix for single role_attr 2014-11-26 14:43:56 -08:00
Devin Christensen
06f1c1a97e Fix user_alter in postgresql_user 2014-11-25 12:04:47 -07:00
Devin Christensen
c77ab67274 Fix user_add in postgresql_user 2014-11-25 11:46:41 -07:00
Devin Christensen
4a3d7473fd Fix syntax error 2014-11-25 10:44:04 -07:00
Toshio Kuratomi
c84ae54294 Normalize privs and flags to uppercase so comparisons against allowed names will work 2014-11-25 00:44:18 -08:00
Toshio Kuratomi
51910a1a33 Audit escaping of identifiers in the postgresql_user module 2014-11-24 22:30:10 -08:00
Michael DeHaan
3ed1378067 Some more module categorization. 2014-11-04 17:23:22 -05:00
Renamed from database/postgresql_user.py (Browse further)