How to give permissions to user groups in PostgreSQL?

0

*Allregistereduserswhoaremembersof"SITE ACCESS" will have the same permissions.

I created a Group Roles in PostgreSQL called "ACCESS SITE" to put all users (Login Roles) of sites and systems that will have permissions to search, insert, update and delete information. When I create a user for a particular system or site I just want to say that it is part of Group (Group Roles) "ACCESS SITE" and it inherits all previously defined group permissions without having to be giving permissions every time they create a new user .

How can I configure Group Roles "SITE ACCESS" by giving permission only once and then only allocate the new users in the group?

    
asked by anonymous 07.07.2017 / 18:22

1 answer

1

Create the group access_site:

CREATE ROLE acesso_site NOINHERIT LOGIN PASSWORD '1';

Set the permissions to it:

GRANT SELECT
  ON public.estoque TO acesso_site;

  GRANT INSERT
  ON public.estoque TO acesso_site;

GRANT USAGE
  ON public.estoque_codigo_seq TO acesso_site;

Create a user, within the acesso_site group:

  CREATE ROLE usuario1 LOGIN PASSWORD '1' IN ROLE acesso_site;

I think it's just that

    
07.07.2017 / 18:58