{"id":92114,"date":"2020-08-23T19:41:56","date_gmt":"2020-08-23T17:41:56","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/realizacziya-rolevoj-modeli-dostupa-s-ispolzovaniem-row-level-security-v-postgresql"},"modified":"2020-08-23T19:41:56","modified_gmt":"2020-08-23T17:41:56","slug":"realizacziya-rolevoj-modeli-dostupa-s-ispolzovaniem-row-level-security-v-postgresql","status":"publish","type":"post","link":"https:\/\/prohoster.info\/it\/blog\/administrirovanie\/realizacziya-rolevoj-modeli-dostupa-s-ispolzovaniem-row-level-security-v-postgresql","title":{"rendered":"Implementazione di un modello di accesso ruoli con utilizzo di Row Level Security in PostgreSQL","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Sviluppo del tema <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/515896\/\">Studio sull'implementazione della Row Level Security in PostgreSQL<\/a><\/noindex> e <b>per una risposta dettagliata<\/b> con <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/515628\/#comment_21973176\">commento.<\/a><\/noindex><\/p>\n<p>La strategia utilizzata implica l'uso del concetto di \"Logica aziendale nel DB\", descritto in modo pi\u00f9 dettagliato qui \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/515628\/\">Studio sulla realizzazione della logica di business a livello di funzioni memorizzate in PostgreSQL<\/a><\/noindex><\/p>\n<p>La parte teorica \u00e8 ben descritta nella documentazione <noindex><a rel=\"nofollow\" href=\"https:\/\/postgrespro.ru\/\">Postgres Pro<\/a><\/noindex> \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/postgrespro.ru\/docs\/postgrespro\/11\/ddl-rowsecurity\">Politiche di protezione delle righe<\/a><\/noindex>. Di seguito viene esaminata l'implementazione pratica <b>di un problema aziendale specifico \u2014 modello di accesso ai dati.<\/b><\/p>\n<p><img decoding=\"async\" alt=\"Implementazione di un modello di accesso ruoli con utilizzo di Row Level Security in PostgreSQL\" src=\"\/wp-content\/uploads\/2020\/08\/df69397b8638421732a67e457c99857c.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<blockquote><p>Nell'articolo non c'\u00e8 nulla di nuovo, nessun significato nascosto e conoscenze segrete. Solo un abbozzo su un'implementazione pratica di un'idea teorica. Se a qualcuno interessa \u2014 leggete. A chi non interessa \u2014 non sprecate il vostro tempo.<\/p><\/blockquote>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Definizione del compito<\/h2>\n<p>\n\u00c8 necessario delimitare l'accesso alla visualizzazione\/inserimento\/modifica\/cancellazione del documento in base al ruolo dell'utente dell'applicazione. Per ruolo si intende una voce nella tabella <b>roles<\/b> collegata da una relazione molti-a-molti con la tabella <b>users<\/b>. I dettagli dell'implementazione delle tabelle sono stati omessi per ovviet\u00e0. Sono stati omessi anche dettagli specifici dell'implementazione legati al dominio.<\/p>\n<h2>Implementazione<\/h2>\n<p><\/p>\n<h4>Creiamo ruoli, schemi, tabella<\/h4>\n<p><\/p>\n<p>                        <b class=\"spoiler_title\">Creazione di oggetti DB<\/b><\/p>\n<pre><code class=\"pgsql\">CREATE ROLE store;\nCREATE SCHEMA store AUTHORIZATION store;\nCREATE TABLE store.docs\n(\n  id integer ,         --id del documento\n  man_id integer , --id del manager del documento\n  stat_id integer ,  --id dello stato del documento\n  ...\n  is_del BOOLEAN DEFAULT FALSE \n);\nALTER TABLE store.docs ADD CONSTRAINT doc_pk PRIMARY KEY (id);\nALTER TABLE store.docs OWNER TO store ;\n<\/code><\/pre>\n<p><\/p>\n<h4>Creiamo funzioni per implementare RLS<\/h4>\n<p>\nVerifica della possibilit\u00e0 di eseguire SELECT su una riga<\/p>\n<p>                        <b class=\"spoiler_title\">check_select<\/b><\/p>\n<pre><code class=\"pgsql\">CREA O SOSTITUISCI LA FUNZIONE store.check_select ( current_id store.docs.id%TYPE ) RESTITUISCE boolean AS $$\nDECLARE\n  risultato boolean ;\n  curr_pid integer ;\n  curr_stat_id integer ;\n  doc_man_id integer ;\nBEGIN \n  -- Il DBA ha accesso a tutti i documenti\n  IF SESSION_USER = 'curr_dba'\n  THEN\n    RETURN TRUE ;\n  END IF ;\n  --------------------------------\n\n  -- Se il documento ha l'etichetta 'cancellato' - non mostrarlo nella selezione\n  SELECT\n    is_del\n  INTO\n    risultato\n  FROM\n    store.docs\n  WHERE\n    id = current_id ;\n IF risultato = TRUE\n THEN\n   RETURN FALSE ;\n END IF ;\n --------------------------------\n\n -- Ottenere l'id dell'utente corrente\n SELECT\n   service_function.get_curr_pid ()\n INTO\n   curr_pid ;\n --------------------------------\n\n -- Ottenere l'id del manager del documento\n SELECT\n   man_id\n INTO\n   doc_man_id\n FROM\n   store.docs\n WHERE\n   id = current_id ;\n --------------------------------\n\n -- Se il manager del documento non \u00e8 l'utente corrente o il manager non \u00e8 assegnato\n -- aggiungere il documento alla selezione\n IF doc_man_id != curr_pid OR doc_man_id IS NULL\n THEN\n   RETURN TRUE  ;\n ELSE\n   -- Ottenere lo stato corrente del documento\n   SELECT\n     stat_id                                         \n   INTO\n     curr_statid\n   FROM\n     store.docs\n   WHERE\n     id = current_id ;\n    \n   -- Se lo stato consente di visualizzare il documento - aggiungere il documento alla selezione                     \n   IF curr_statid = 4 OR curr_statid = 9\n   THEN\n     RETURN TRUE ;\n   ELSE\n   -- Altrimenti - escludere il documento dalla selezione\n     RETURN FALSE ;\n    END IF ;\n  END IF ;\n  --------------------------------\n\n RETURN FALSE ;\nEND\n$$ LINGUAGGIO plpgsql SECURITY DEFINER;\nALTERA FUNZIONE store.check_select( store.docs.id%TYPE  ) PROPRIETARIO A store ;\nREVOCARE ESECUZIONE SULLA FUNZIONE store.check_select( store.docs.id%TYPE  ) DA public; \nCONCEDERE ESECUZIONE SULLA FUNZIONE store.check_select( store.docs.id%TYPE  ) A service_functions; \n<\/code><\/pre>\n<p>\nVerifica la possibilit\u00e0 di eseguire un'istruzione INSERT di una riga<\/p>\n<p>                        <b class=\"spoiler_title\">check_insert<\/b><\/p>\n<pre><code class=\"pgsql\">CREATE OR REPLACE FUNCTION store.check_insert ( current_id store.docs.id%TYPE ) RETURNS boolean AS $$\nDECLARE\n  curr_role_id integer ;\nBEGIN\n  --Il DBA pu\u00f2 aggiungere una riga in ogni caso\n  IF SESSION_USER = 'curr_dba'\n  THEN\n    RETURN TRUE ;\n  END IF ;\n  --------------------------------\n\n --Ottenere l'id del ruolo dell'utente attuale \n SELECT\n   service_functions.current_rid()\n  INTO\n    curr_role_id ;\n --------------------------------\n\n--Se il ruolo consente la creazione di un nuovo documento\n--permettere\nIF curr_role_id = 3 OR curr_role_id = 5     \nTHEN\n  RETURN TRUE ;\nEND IF ;\n--------------------------------\nRETURN FALSE  ;\nEND\n$$ LANGUAGE plpgsql SECURITY DEFINER;\nALTER FUNCTION store.check_insert( store.docs.id%TYPE  ) OWNER TO store ;\nREVOKE EXECUTE ON FUNCTION store.check_insert( store.docs.id%TYPE  ) FROM public;\nGRANT EXECUTE ON FUNCTION store.check_insert( store.docs.id%TYPE  ) TO service_functions; \n<\/code><\/pre>\n<p>\nVerifica la possibilit\u00e0 di eseguire un'istruzione DELETE di una riga<\/p>\n<p>                        <b class=\"spoiler_title\">check_delete<\/b><\/p>\n<pre><code class=\"pgsql\">CREATE OR REPLACE FUNCTION store.check_delete ( current_id store.docs.id%TYPE )\nRETURNS boolean AS $$\nBEGIN  \n  --Solo il DBA pu\u00f2 eliminare una riga \n  IF SESSION_USER = 'curr_dba'\n  THEN\n    RETURN TRUE ;\n  END IF ;\n  --------------------------------\n\n  RETURN FALSE ;\nEND\n$$ LANGUAGE plpgsql\nSECURITY DEFINER;\nALTER FUNCTION store.check_delete( store.docs.id%TYPE  ) OWNER TO store ;\nREVOKE EXECUTE ON FUNCTION store.check_delete( store.docs.id%TYPE  ) FROM public;<\/code><\/pre>\n<p>\nVerifica la possibilit\u00e0 di eseguire un'istruzione UPDATE di una riga.<\/p>\n<p>                        <b class=\"spoiler_title\">update_using<\/b><\/p>\n<pre><code class=\"pgsql\">CREATE OR REPLACE FUNCTION store.update_using ( current_id store.docs.id%TYPE , is_del boolean  )\nRETURNS boolean AS $$\nBEGIN  \n   --I documenti con stato 'eliminato' non possono essere modificati\n   IF is_del \n   THEN\n     RETURN FALSE ;\n ELSE\n    RETURN TRUE ;\n  END IF ;\n\nEND\n$$ LANGUAGE plpgsql SECURITY DEFINER;\nALTER FUNCTION store.update_using(  store.docs.id%TYPE ,  boolean  ) OWNER TO store ;\nREVOKE EXECUTE ON FUNCTION store.update_using(  store.docs.id%TYPE ,  boolean  ) FROM public;\nGRANT EXECUTE ON FUNCTION store.update_using( store.docs.id%TYPE  ) TO service_functions;<\/code><\/pre>\n<p><\/p>\n<p>                        <b class=\"spoiler_title\">update_check<\/b><\/p>\n<pre><code class=\"pgsql\">CREATE OR REPLACE FUNCTION store.update_with_check ( current_id store.docs.id%TYPE , is_del boolean )\nRETURNS boolean AS $$\nDECLARE\n  current_rid integer ;\n  current_statid integer ;\nBEGIN                \n\n  --Il DBA pu\u00f2 visualizzare la riga \n  IF SESSION_USER = 'curr_dba'\n  THEN\n    RETURN TRUE ;\n  END IF ;\n  --------------------------------\n\n --Ottieni l'id del ruolo dell'utente attuale \n SELECT\n   service_functions.current_rid()\n  INTO\n    curr_role_id ;\n --------------------------------                            \n\n --Eliminazione del documento - modifica del flag \n IF is_deleted\n THEN\n   --Se il ruolo dell'utente ***\n   IF current_role_id = 3        \n   THEN\n      SELECT\n        stat_id                                          \n      INTO\n        curr_statid\n      FROM\n        store.docs\n      WHERE\n        id = current_id ;\n\n      --Il documento in stato *** non pu\u00f2 essere eliminato \n      IF current_status_id = 11\n      THEN\n         RETURN FALSE ;\n      ELSE\n      --\u00c8 possibile eliminare il documento in altri stati\n        RETURN TRUE ;\n      END IF ;\n\n    --Altrimenti, se il ruolo dell'utente ***\n    ELSIF current_role_id = 5            \n    THEN\n      --Tutti gli stati del documento \n      RETURN TRUE ;\n    ELSE\n      --Altri utenti non possono eliminare documenti\n      RETURN FALSE ;\n    END IF ;\n ELSE      \n   --Aggiornamento del documento consentito\n    RETURN TRUE ;\nEND IF ;\n\nRETURN FALSE ;\nEND\n$$ LANGUAGE plpgsql SECURITY DEFINER;\nALTER FUNCTION store.update_with_check( storg.docs.id%TYPE ,  boolean   ) OWNER TO store ;\nREVOKE EXECUTE ON FUNCTION store.update_with_check( storg.docs.id%TYPE ,  boolean   )  FROM public;\nGRANT EXECUTE ON FUNCTION store.update_with_check( store.docs.id%TYPE  ) TO service_functions;<\/code><\/pre>\n<p>\nAttivazione della politica di Row Level Security per la tabella.<\/p>\n<p>                        <b class=\"spoiler_title\">ABILITA ROW LEVEL SECURITY<\/b><\/p>\n<pre><code class=\"pgsql\">ALTER TABLE store.docs ABILITA ROW LEVEL SECURITY ;\n\nCREATE POLICY doc_select ON store.docs FOR SELECT TO service_functions USING ( (SELECT store.check_select(id)) );\nCREATE POLICY doc_insert ON store.docs FOR INSERT TO service_functions WITH CHECK ( (SELECT store.check_insert(id)) );\nCREATE POLICY docs_delete ON store.docs FOR DELETE TO service_functions USING ( (SELECT store.check_delete(id)) );\n\nCREATE POLICY doc_update_using ON store.docs FOR UPDATE TO service_functions USING ( (SELECT store.update_using(id , is_del )) );\nCREATE POLICY doc_update_check ON store.docs FOR UPDATE TO service_functions  WITH CHECK ( (SELECT store.update_with_check(id , is_del )) );<\/code><\/pre>\n<p><\/p>\n<h2>Risultato<\/h2>\n<p>\nFunziona.<\/p>\n<p>La strategia proposta ha permesso di trasferire l'implementazione del modello di ruoli dal livello delle funzioni aziendali al livello di archiviazione dei dati. <\/p>\n<p>Le funzioni possono essere utilizzate come modello per implementare modelli di occultamento dei dati pi\u00f9 sofisticati, qualora le esigenze aziendali lo richiedano.<br \/>\n<br \/>Fonte: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/516040\/\">habr.com<\/a> <\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0420\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u0442\u0435\u043c\u044b \u042d\u0442\u044e\u0434 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Row Level Secutity \u0432 PostgreSQL \u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u00ab\u0411\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430 \u0432 \u0411\u0414\u00bb, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u2014 \u042d\u0442\u044e\u0434 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 PostgreSQL \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Postgres Pro \u2014 \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0437\u0430\u0449\u0438\u0442\u044b \u0441\u0442\u0440\u043e\u043a. \u041d\u0438\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":92115,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-92114","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0420\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u0442\u0435\u043c\u044b \u042d\u0442\u044e\u0434 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Row Level Secutity \u0432 PostgreSQL \u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u00ab\u0411\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430 \u0432 \u0411\u0414\u00bb, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u2014 \u042d\u0442\u044e\u0434 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 PostgreSQL \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Postgres Pro \u2014 \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0437\u0430\u0449\u0438\u0442\u044b \u0441\u0442\u0440\u043e\u043a. \u041d\u0438\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/it\/blog\/administrirovanie\/realizacziya-rolevoj-modeli-dostupa-s-ispolzovaniem-row-level-security-v-postgresql\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"it_IT\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u043e\u043b\u0435\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Row Level Security \u0432 PostgreSQL | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0420\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u0442\u0435\u043c\u044b \u042d\u0442\u044e\u0434 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Row Level Secutity \u0432 PostgreSQL \u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u00ab\u0411\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430 \u0432 \u0411\u0414\u00bb, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u2014 \u042d\u0442\u044e\u0434 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 PostgreSQL \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Postgres Pro \u2014 \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0437\u0430\u0449\u0438\u0442\u044b \u0441\u0442\u0440\u043e\u043a. \u041d\u0438\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/it\/blog\/administrirovanie\/realizacziya-rolevoj-modeli-dostupa-s-ispolzovaniem-row-level-security-v-postgresql\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-08-23T17:41:56+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-08-23T17:41:56+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Implementazione del modello di accesso basato su ruoli utilizzando la Row Level Security in PostgreSQL | ProHoster","description":"Sviluppo del tema Studio sull'implementazione della Row Level Security in PostgreSQL e per una risposta approfondita ai commenti. La strategia utilizzata implica l'uso del concetto di \u00abLogica aziendale nel database\u00bb, che \u00e8 stata descritta in modo un po' pi\u00f9 dettagliato qui \u2014 Studio sull'implementazione della logica aziendale a livello di funzioni memorizzate PostgreSQL. La parte teorica \u00e8 ben descritta nella documentazione di Postgres Pro \u2014 Politiche di protezione delle righe. Di seguito viene considerata la parte pratica.","canonical_url":"https:\/\/prohoster.info\/it\/blog\/administrirovanie\/realizacziya-rolevoj-modeli-dostupa-s-ispolzovaniem-row-level-security-v-postgresql","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"it_IT","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u043e\u043b\u0435\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Row Level Security \u0432 PostgreSQL | ProHoster","og:description":"\u0420\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u0442\u0435\u043c\u044b \u042d\u0442\u044e\u0434 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Row Level Secutity \u0432 PostgreSQL \u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u00ab\u0411\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430 \u0432 \u0411\u0414\u00bb, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u2014 \u042d\u0442\u044e\u0434 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 PostgreSQL \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Postgres Pro \u2014 \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0437\u0430\u0449\u0438\u0442\u044b \u0441\u0442\u0440\u043e\u043a. \u041d\u0438\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f","og:url":"https:\/\/prohoster.info\/it\/blog\/administrirovanie\/realizacziya-rolevoj-modeli-dostupa-s-ispolzovaniem-row-level-security-v-postgresql","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-08-23T17:41:56+00:00","article:modified_time":"2020-08-23T17:41:56+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"92114","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 12:14:23","updated":"2022-10-06 10:04:45"},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/posts\/92114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/comments?post=92114"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/posts\/92114\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/media\/92115"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/media?parent=92114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/categories?post=92114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/tags?post=92114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}