-
Notifications
You must be signed in to change notification settings - Fork 35
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
Create schema of same name when user is created #171
Comments
Hi @joshlk actually, you can already do this by hacking the ACL mechanism :-) Just think acls:
user_schema:
type: datacl
inspect: |
SELECT NULL as "schema", rolname
FROM pg_namespace n
JOIN pg_authid ON rolname = nspname
grant: |
CREATE SCHEMA {role};
ALTER USER {role} SET search_path {role},public;
sync_map:
- role: myuser
grant:
acl: user_schema
database: mydb
role: myuser YMMV |
I'm thinking of extending ldap2pg to help managing this case. Here is an idea: - role:
name: '{cn}'
on_create: |
CREATE SCHEMA {role};
on_alter: |
ALTER SCHEMA {old} RENAME TO {new};
on_drop: |
DROP SCHEMA {role} CASCADE; What do you think of it ? Would you prefer global |
Another solution would be the allows override of queries : postgres:
queries:
role_create: |
CREATE ROLE "{role}" WITH {options};
COMMENT ON ROLE "{role}" IS '{comment}';
CREATE SCHEMA "{role}";
ALTER ROLE "{role}" SET search_path = "{role}",public; |
@bersace, is it still considered ? This looks quite interesting. Would definitely be useful for me ! |
I would like to see both. Some queries might be useful on a global level, others just for specific roles. |
Closing in favor of #565. |
It common to have a schema that the same name as a user in a database. By default, postgres includes such a schema in its
search_path
automatically, see "section 5.8.3" in the docs.It would be ace to have an option in ldap2pg that would create a schema of the same name when a user is newly created.
Thanks
The text was updated successfully, but these errors were encountered: