postgresql_privs: Fix bug with grant_option (#796)

This commit is contained in:
Milan Ilic 2020-08-21 12:57:26 +02:00 committed by GitHub
parent b797922e20
commit f3b82a9470
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: