Git Product home page Git Product logo

Comments (6)

jeanpommier avatar jeanpommier commented on September 3, 2024 1

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;

@bersace, is it still considered ? This looks quite interesting. Would definitely be useful for me !

from ldap2pg.

bersace avatar bersace commented on September 3, 2024

Hi @joshlk actually, you can already do this by hacking the ACL mechanism :-) Just think grant as create and revoke as drop. This should look like:

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

from ldap2pg.

bersace avatar bersace commented on September 3, 2024

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 on_create, on_drop ? Thanks for the feedback.

from ldap2pg.

bersace avatar bersace commented on September 3, 2024

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;

from ldap2pg.

alehaa avatar alehaa commented on September 3, 2024

Would you prefer global on_create, on_drop ? Thanks for the feedback.

I would like to see both. Some queries might be useful on a global level, others just for specific roles.

from ldap2pg.

bersace avatar bersace commented on September 3, 2024

Closing in favor of #565.

from ldap2pg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.