postgresql_privs: Fix bug with grant_option (#796) (#912)

(cherry picked from commit f3b82a9470)

Co-authored-by: Milan Ilic <35260522+ilicmilan@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2020-09-17 19:34:28 +02:00 committed by GitHub
parent 79616f47cb
commit 4685a53f29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 139 additions and 6 deletions

View file

@ -864,12 +864,14 @@ class QueryBuilder(object):
self.query[-1] += ' WITH ADMIN OPTION;'
else:
self.query[-1] += ' WITH GRANT OPTION;'
else:
elif self._grant_option is False:
self.query[-1] += ';'
if self._obj_type == 'group':
self.query.append('REVOKE ADMIN OPTION FOR {0} FROM {1};'.format(self._set_what, self._for_whom))
elif not self._obj_type == 'default_privs':
self.query.append('REVOKE GRANT OPTION FOR {0} FROM {1};'.format(self._set_what, self._for_whom))
else:
self.query[-1] += ';'
def add_default_priv(self):
for obj in self._objs: