{"id":466355,"date":"2025-07-07T21:01:01","date_gmt":"2025-07-07T21:01:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=466355"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=466355","title":{"rendered":"<span>ABAC \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445: \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0435\u0448\u043a\u0430 \u043f\u0440\u0430\u0432, \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API \u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u0442\u0435\u0440\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><strong>\u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (ABAC) \u0432 \u043a\u0440\u0443\u043f\u043d\u043e\u0439 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445<\/strong> \u2014 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u043e\u0432. ABAC \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 IAM (Identity and Access Management) \u0432 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u043e\u043c\u0430\u0442\u044c \u043c\u043e\u0437\u0433 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c, \u0438 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430\u043c. \u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e, \u043a\u0430\u043a \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430\u043c\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 API \u0434\u043b\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<hr\/>\n<h3>\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0435\u0448\u0430\u043b\u0438<\/h3>\n<ul>\n<li>\n<p><strong>\u0410\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u0441\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:<\/strong> \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0441\u0445\u0435\u043c\u043e\u0439, \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432:<\/strong> \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0430\u0432\u0430 &#171;\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0441\u0451&#187;, \u043f\u0440\u0430\u0432\u0430 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c, \u043f\u0440\u0430\u0432\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438:<\/strong> \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u0441\u0442\u044c:<\/strong> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u044b\u0441\u043e\u043a\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/strong> \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f 2+ \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0430 &lt; 50 \u043c\u0441.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u0440\u0430\u0432\u0430\u0445 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0443 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439\/\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435).<\/strong><\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0430\u0432 (ABAC-\u043c\u0430\u0442\u0440\u0435\u0448\u043a\u0430)<\/h3>\n<p>\u0412\u0441\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432 \u2014 \u00ab\u043c\u0430\u0442\u0440\u0435\u0448\u043a\u0430\u00bb:<\/p>\n<ol>\n<li>\n<p><strong>\u0411\u0438\u0437\u043d\u0435\u0441-\u0440\u043e\u043b\u044c<\/strong><\/p>\n<ul>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u043c\u0438\u043d\u043e\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#171;\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0440\u043e\u0435\u043a\u0442\u0430&#187;).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0440\u043e\u043b\u0438<\/strong><\/p>\n<ul>\n<li>\n<p>\u0417\u0430\u0434\u0430\u044e\u0442 \u043d\u0430\u0431\u043e\u0440\u044b \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#171;\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c&#187;, &#171;\u0421\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0438\u0439&#187;).<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\u043c\u0438 \u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b (\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a\u0430\u043a change request). \u041f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u0430 \u043a \u0431\u0438\u0437\u043d\u0435\u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f<\/strong><\/p>\n<ul>\n<li>\n<p>\u0416\u0435\u0441\u0442\u043a\u043e \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>documents.view<\/code>, <code>documents.sign<\/code>, <code>documents.approver<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u0432 \u043a\u043e\u0434\u0435 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439<\/strong><\/p>\n<ul>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0434\u0435\u0442\u0430\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0441\u0440\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 (\u043d\u0430\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0434\u0430\u0447\u0435 \u0431\u0438\u0437\u043d\u0435\u0441-\u0440\u043e\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e) \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 (\u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<hr\/>\n<h3>\u041c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445: \u043c\u0430\u0442\u0440\u0435\u0448\u043a\u0430 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c<\/h3>\n<h4>1. \u041c\u043e\u0434\u0435\u043b\u044c \u0440\u043e\u043b\u0435\u0439 \u0438 \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439 (\u0448\u0430\u0431\u043b\u043e\u043d, \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e):<\/h4>\n<pre><code class=\"json\">{   \"business_role\": \"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440_Alpha\",   \"system_roles\": [     {       \"name\": \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\",       \"permissions\": [         {           \"permission\": \"documents.view\",           \"attributes\": {}         },         {           \"permission\": \"documents.sign\",           \"attributes\": {}         }       ]     }   ] } <\/code><\/pre>\n<h4>2. \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (\u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b):<\/h4>\n<pre><code class=\"json\">{   \"user_id\": \"petrov\",   \"business_roles\": [     {       \"name\": \"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440_Alpha\",       \"system_roles\": [         {           \"name\": \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\",           \"permissions\": [             {               \"permission\": \"documents.view\",               \"attributes\": {                 \"projects\": [101, 102]               }             },             {               \"permission\": \"documents.sign\",               \"attributes\": {                 \"projects\": [101]               }             }           ]         }       ]     }   ] } <\/code><\/pre>\n<ul>\n<li>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u0432 <strong>\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u0445<\/strong> \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<h4>3. \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 (\u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435) \u043f\u0440\u0430\u0432\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0430\u0432\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443 \u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u0438 \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u0430\u043c\u0438\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c):<\/h4>\n<pre><code class=\"json\">[   {     \"user_id\": \"petrov\",     \"permission\": \"documents.approver\",     \"attributes\": {       \"documents\": [999, 888]     }   },   {     \"user_id\": \"ivanov\",     \"permission\": \"documents.view\",     \"attributes\": {       \"secret\": [123]     }   } ] <\/code><\/pre>\n<ul>\n<li>\n<p>\u0417\u0434\u0435\u0441\u044c <code>\"documents\"<\/code> \u2014 \u044d\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0435\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u043e \u043a\u0430\u043a \u0443 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p><code>\"secret\"<\/code> \u2014 \u044f\u0432\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440\u044b: \u043a\u0430\u043a \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u043a\u0435\u0439\u0441\u044b<\/h3>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430:<\/strong> \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0432\u0438\u0434\u0435\u0442\u044c.<\/p>\n<h4>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/h4>\n<ul>\n<li>\n<p><code>has_view_all<\/code> \u2014 \u0431\u0443\u043b\u0435\u0432\u043e: \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0430\u0432\u043e <code>documents.view_all<\/code><\/p>\n<\/li>\n<li>\n<p><code>allowed_projects<\/code> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 <code>documents.view<\/code><\/p>\n<\/li>\n<li>\n<p><code>allowed_documents<\/code> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0430\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0438\u0439<\/p>\n<\/li>\n<li>\n<p><code>secret_documents<\/code> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u044f\u0432\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u0432\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b<\/p>\n<\/li>\n<\/ul>\n<h4>SQL-\u0437\u0430\u043f\u0440\u043e\u0441<\/h4>\n<pre><code class=\"sql\">SELECT * FROM documents WHERE     (:has_view_all)     OR (project_id = ANY(:allowed_projects))     OR (id = ANY(:allowed_documents))     OR (id = ANY(:secret_documents)) <\/code><\/pre>\n<p><strong>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 <code>has_view_all<\/code> = True, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0432\u0438\u0434\u0438\u0442 \u0432\u0441\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u043f\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u2014 \u043b\u044e\u0431\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0438\u0439 \u0438\u043b\u0438 \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435 secret).<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 Python<\/h4>\n<pre><code class=\"python\">def get_user_documents(user):     # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 \u043a\u044d\u0448\u0430 \u0438\u043b\u0438 \u0440\u0435\u043f\u043b\u0438\u043a\u0438 \u0431\u0430\u0437\u044b)     perms = get_user_permissions(user)      has_view_all = perms.get('documents.view_all', False)     allowed_projects = perms.get('documents.view', {}).get('projects', [])     allowed_documents = get_local_permissions(user, 'documents.approver').get('documents', [])     secret_documents = get_local_permissions(user, 'documents.view').get('secret', [])      query = \"\"\"         SELECT * FROM documents         WHERE             (%s)             OR (project_id = ANY(%s))             OR (id = ANY(%s))             OR (id = ANY(%s))     \"\"\"     params = (         has_view_all,         allowed_projects,         allowed_documents,         secret_documents     )     return db.execute(query, params) <\/code><\/pre>\n<hr\/>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440: \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0430\u0432 (\u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443)<\/h4>\n<pre><code class=\"python\">def grant_secret_document_access(user_id, doc_id):     # \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443 \u0441 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c secret     permission_record = {         \"user_id\": user_id,         \"permission\": \"documents.view\",         \"attributes\": {             \"secret\": [doc_id]         }     }     save_permission(permission_record) <\/code><\/pre>\n<hr\/>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043c\u0435\u043d\u044e \u0432\u043e \u0444\u0440\u043e\u043d\u0442\u0435 (React)<\/h4>\n<pre><code class=\"javascript\">import { usePermissions } from '@company\/shared-kernel';  function Sidebar() {   const { hasPermission } = usePermissions();    return (     &lt;nav&gt;       {hasPermission('documents.view') &amp;&amp; (         &lt;MenuItem icon=\"documents\"&gt;\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b&lt;\/MenuItem&gt;       )}       {hasPermission('documents.sign') &amp;&amp; (         &lt;MenuItem icon=\"sign\"&gt;\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c&lt;\/MenuItem&gt;       )}     &lt;\/nav&gt;   ); } <\/code><\/pre>\n<ul>\n<li>\n<p>\u041c\u0435\u043d\u044e \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u044e \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439 \u0432 \u0442\u043e\u043a\u0435\u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u0440\u0430\u0432 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u043b\u043e\u0436\u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0438, \u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430 \u0441\u043d\u0430\u0440\u0443\u0436\u0438<\/h3>\n<ul>\n<li>\n<p><strong>\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440<\/strong> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0431\u0438\u0437\u043d\u0435\u0441-\u0440\u043e\u043b\u044f\u043c\u0438 \u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u0440\u043e\u043b\u044f\u043c\u0438. \u0414\u043b\u044f \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 UI \u2014 \u0432\u0441\u0451 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0411\u0438\u0437\u043d\u0435\u0441-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a<\/strong> \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0440\u043e\u043b\u0438, \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u043e \u043f\u043e\u043b\u043d\u043e\u0442\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 (\u0447\u0442\u043e\u0431\u044b \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0434\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u043e \u043d\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0435\u0437 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440). \u041d\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0440\u043e\u043b\u0438 \u043e\u043d\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f &#171;\u043d\u0430 \u043b\u0435\u0442\u0443&#187;.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/strong> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f\u043c\u0438 \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 \u2014 \u0432\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043f\u0440\u044f\u0442\u0430\u043d\u0430 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 shared-kernel, \u0438 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0430\u0432 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0430 \u0434\u043e \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u0438\u0441\u043a<\/strong> \u2014 \u043d\u0435 \u0443\u0439\u0442\u0438 \u0432 \u0447\u0440\u0435\u0437\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0432\u044f\u0437\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f &#171;\u043d\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u2014 \u0437\u043d\u0430\u0447\u0438\u0442 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043e&#187;.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<ul>\n<li>\n<p>ABAC \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0442\u0435\u043c \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c. \u0414\u0430\u0436\u0435 \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u043b\u0438\u0448\u044c \u0432\u0435\u0440\u0445\u0443\u0448\u043a\u0430 \u0430\u0439\u0441\u0431\u0435\u0440\u0433\u0430, \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u0412\u0441\u0451 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u2014 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432, \u043d\u0435 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u043a\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0413\u043b\u0430\u0432\u043d\u043e\u0435: \u043f\u0440\u0438 \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0433\u0438\u0431\u043a\u0443\u044e, \u043c\u043e\u0449\u043d\u0443\u044e \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0430\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0431\u0438\u0437\u043d\u0435\u0441\u0443 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e: \u043e\u0434\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0440\u0443\u0447\u043d\u044b\u0445 join \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0439 &#171;\u043c\u0430\u0442\u0440\u0435\u0448\u043a\u0438&#187;.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u0410 \u043a\u0430\u043a \u0443 \u0432\u0430\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430? \u0414\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u043a\u0435\u0439\u0441\u0430\u043c\u0438 \u0438 \u0431\u043e\u043b\u044f\u043c\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/p>\n<\/blockquote>\n<hr\/>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/925612\/\"> https:\/\/habr.com\/ru\/articles\/925612\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><strong>\u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (ABAC) \u0432 \u043a\u0440\u0443\u043f\u043d\u043e\u0439 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445<\/strong> \u2014 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u043e\u0432. ABAC \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 IAM (Identity and Access Management) \u0432 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u043e\u043c\u0430\u0442\u044c \u043c\u043e\u0437\u0433 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c, \u0438 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430\u043c. \u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e, \u043a\u0430\u043a \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430\u043c\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 API \u0434\u043b\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<hr\/>\n<h3>\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0435\u0448\u0430\u043b\u0438<\/h3>\n<ul>\n<li>\n<p><strong>\u0410\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u0441\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:<\/strong> \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0441\u0445\u0435\u043c\u043e\u0439, \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432:<\/strong> \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0430\u0432\u0430 &#171;\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0441\u0451&#187;, \u043f\u0440\u0430\u0432\u0430 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c, \u043f\u0440\u0430\u0432\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438:<\/strong> \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u0441\u0442\u044c:<\/strong> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u044b\u0441\u043e\u043a\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/strong> \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f 2+ \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0430 &lt; 50 \u043c\u0441.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u0440\u0430\u0432\u0430\u0445 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0443 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439\/\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435).<\/strong><\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0430\u0432 (ABAC-\u043c\u0430\u0442\u0440\u0435\u0448\u043a\u0430)<\/h3>\n<p>\u0412\u0441\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432 \u2014 \u00ab\u043c\u0430\u0442\u0440\u0435\u0448\u043a\u0430\u00bb:<\/p>\n<ol>\n<li>\n<p><strong>\u0411\u0438\u0437\u043d\u0435\u0441-\u0440\u043e\u043b\u044c<\/strong><\/p>\n<ul>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u043c\u0438\u043d\u043e\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#171;\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0440\u043e\u0435\u043a\u0442\u0430&#187;).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0440\u043e\u043b\u0438<\/strong><\/p>\n<ul>\n<li>\n<p>\u0417\u0430\u0434\u0430\u044e\u0442 \u043d\u0430\u0431\u043e\u0440\u044b \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#171;\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c&#187;, &#171;\u0421\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0438\u0439&#187;).<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\u043c\u0438 \u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b (\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a\u0430\u043a change request). \u041f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u0430 \u043a \u0431\u0438\u0437\u043d\u0435\u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f<\/strong><\/p>\n<ul>\n<li>\n<p>\u0416\u0435\u0441\u0442\u043a\u043e \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>documents.view<\/code>, <code>documents.sign<\/code>, <code>documents.approver<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u0432 \u043a\u043e\u0434\u0435 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439<\/strong><\/p>\n<ul>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0434\u0435\u0442\u0430\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0441\u0440\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 (\u043d\u0430\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0434\u0430\u0447\u0435 \u0431\u0438\u0437\u043d\u0435\u0441-\u0440\u043e\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e) \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 (\u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<hr\/>\n<h3>\u041c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445: \u043c\u0430\u0442\u0440\u0435\u0448\u043a\u0430 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c<\/h3>\n<h4>1. \u041c\u043e\u0434\u0435\u043b\u044c \u0440\u043e\u043b\u0435\u0439 \u0438 \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439 (\u0448\u0430\u0431\u043b\u043e\u043d, \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e):<\/h4>\n<pre><code class=\"json\">{   \"business_role\": \"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440_Alpha\",   \"system_roles\": [     {       \"name\": \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\",       \"permissions\": [         {           \"permission\": \"documents.view\",           \"attributes\": {}         },         {           \"permission\": \"documents.sign\",           \"attributes\": {}         }       ]     }   ] } <\/code><\/pre>\n<h4>2. \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (\u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b):<\/h4>\n<pre><code class=\"json\">{   \"user_id\": \"petrov\",   \"business_roles\": [     {       \"name\": \"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440_Alpha\",       \"system_roles\": [         {           \"name\": \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\",           \"permissions\": [             {               \"permission\": \"documents.view\",               \"attributes\": {                 \"projects\": [101, 102]               }             },             {               \"permission\": \"documents.sign\",               \"attributes\": {                 \"projects\": [101]               }             }           ]         }       ]     }   ] } <\/code><\/pre>\n<ul>\n<li>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u0432 <strong>\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u0445<\/strong> \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<h4>3. \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 (\u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435) \u043f\u0440\u0430\u0432\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0430\u0432\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443 \u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u0438 \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u0430\u043c\u0438\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c):<\/h4>\n<pre><code class=\"json\">[   {     \"user_id\": \"petrov\",     \"permission\": \"documents.approver\",     \"attributes\": {       \"documents\": [999, 888]     }   },   {     \"user_id\": \"ivanov\",     \"permission\": \"documents.view\",     \"attributes\": {       \"secret\": [123]     }   } ] <\/code><\/pre>\n<ul>\n<li>\n<p>\u0417\u0434\u0435\u0441\u044c <code>\"documents\"<\/code> \u2014 \u044d\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0435\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u043e \u043a\u0430\u043a \u0443 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p><code>\"secret\"<\/code> \u2014 \u044f\u0432\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440\u044b: \u043a\u0430\u043a \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u043a\u0435\u0439\u0441\u044b<\/h3>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430:<\/strong> \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0432\u0438\u0434\u0435\u0442\u044c.<\/p>\n<h4>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/h4>\n<ul>\n<li>\n<p><code>has_view_all<\/code> \u2014 \u0431\u0443\u043b\u0435\u0432\u043e: \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0430\u0432\u043e <code>documents.view_all<\/code><\/p>\n<\/li>\n<li>\n<p><code>allowed_projects<\/code> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 <code>documents.view<\/code><\/p>\n<\/li>\n<li>\n<p><code>allowed_documents<\/code> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0430\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0438\u0439<\/p>\n<\/li>\n<li>\n<p><code>secret_documents<\/code> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u044f\u0432\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u0432\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b<\/p>\n<\/li>\n<\/ul>\n<h4>SQL-\u0437\u0430\u043f\u0440\u043e\u0441<\/h4>\n<pre><code class=\"sql\">SELECT * FROM documents WHERE     (:has_view_all)     OR (project_id = ANY(:allowed_projects))     OR (id = ANY(:allowed_documents))     OR (id = ANY(:secret_documents)) <\/code><\/pre>\n<p><strong>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 <code>has_view_all<\/code> = True, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0432\u0438\u0434\u0438\u0442 \u0432\u0441\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u043f\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u2014 \u043b\u044e\u0431\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0449\u0438\u0439 \u0438\u043b\u0438 \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435 secret).<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 Python<\/h4>\n<pre><code class=\"python\">def get_user_documents(user):     # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 \u043a\u044d\u0448\u0430 \u0438\u043b\u0438 \u0440\u0435\u043f\u043b\u0438\u043a\u0438 \u0431\u0430\u0437\u044b)     perms = get_user_permissions(user)      has_view_all = perms.get('documents.view_all', False)     allowed_projects = perms.get('documents.view', {}).get('projects', [])     allowed_documents = get_local_permissions(user, 'documents.approver').get('documents', [])     secret_documents = get_local_permissions(user, 'documents.view').get('secret', [])      query = \"\"\"         SELECT * FROM documents         WHERE             (%s)             OR (project_id = ANY(%s))             OR (id = ANY(%s))             OR (id = ANY(%s))     \"\"\"     params = (         has_view_all,         allowed_projects,         allowed_documents,         secret_documents     )     return db.execute(query, params) <\/code><\/pre>\n<hr\/>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440: \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0430\u0432 (\u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443)<\/h4>\n<pre><code class=\"python\">def grant_secret_document_access(user_id, doc_id):     # \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443 \u0441 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c secret     permission_record = {         \"user_id\": user_id,         \"permission\": \"documents.view\",         \"attributes\": {             \"secret\": [doc_id]         }     }     save_permission(permission_record) <\/code><\/pre>\n<hr\/>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043c\u0435\u043d\u044e \u0432\u043e \u0444\u0440\u043e\u043d\u0442\u0435 (React)<\/h4>\n<pre><code class=\"javascript\">import { usePermissions } from '@company\/shared-kernel';  function Sidebar() {   const { hasPermission } = usePermissions();    return (     &lt;nav&gt;       {hasPermission('documents.view') &amp;&amp; (         &lt;MenuItem icon=\"documents\"&gt;\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b&lt;\/MenuItem&gt;       )}       {hasPermission('documents.sign') &amp;&amp; (         &lt;MenuItem icon=\"sign\"&gt;\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c&lt;\/MenuItem&gt;       )}     &lt;\/nav&gt;   ); } <\/code><\/pre>\n<ul>\n<li>\n<p>\u041c\u0435\u043d\u044e \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u044e \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439 \u0432 \u0442\u043e\u043a\u0435\u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u0440\u0430\u0432 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u043b\u043e\u0436\u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0438, \u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430 \u0441\u043d\u0430\u0440\u0443\u0436\u0438<\/h3>\n<ul>\n<li>\n<p><strong>\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440<\/strong> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0431\u0438\u0437\u043d\u0435\u0441-\u0440\u043e\u043b\u044f\u043c\u0438 \u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u0440\u043e\u043b\u044f\u043c\u0438. \u0414\u043b\u044f \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 UI \u2014 \u0432\u0441\u0451 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0411\u0438\u0437\u043d\u0435\u0441-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a<\/strong> \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0440\u043e\u043b\u0438, \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u043e \u043f\u043e\u043b\u043d\u043e\u0442\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 (\u0447\u0442\u043e\u0431\u044b \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0434\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u043e \u043d\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0435\u0437 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440). \u041d\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0440\u043e\u043b\u0438 \u043e\u043d\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f &#171;\u043d\u0430 \u043b\u0435\u0442\u0443&#187;.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/strong> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f\u043c\u0438 \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 \u2014 \u0432\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043f\u0440\u044f\u0442\u0430\u043d\u0430 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 shared-kernel, \u0438 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0430\u0432 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0430 \u0434\u043e \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u0438\u0441\u043a<\/strong> \u2014 \u043d\u0435 \u0443\u0439\u0442\u0438 \u0432 \u0447\u0440\u0435\u0437\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0432\u044f\u0437\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f &#171;\u043d\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u2014 \u0437\u043d\u0430\u0447\u0438\u0442 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043e&#187;.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<ul>\n<li>\n<p>ABAC \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0442\u0435\u043c \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c. \u0414\u0430\u0436\u0435 \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u043b\u0438\u0448\u044c \u0432\u0435\u0440\u0445\u0443\u0448\u043a\u0430 \u0430\u0439\u0441\u0431\u0435\u0440\u0433\u0430, \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u0412\u0441\u0451 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u2014 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432, \u043d\u0435 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u043a\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0413\u043b\u0430\u0432\u043d\u043e\u0435: \u043f\u0440\u0438 \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0433\u0438\u0431\u043a\u0443\u044e, \u043c\u043e\u0449\u043d\u0443\u044e \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0430\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0431\u0438\u0437\u043d\u0435\u0441\u0443 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e: \u043e\u0434\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0440\u0443\u0447\u043d\u044b\u0445 join \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0439 &#171;\u043c\u0430\u0442\u0440\u0435\u0448\u043a\u0438&#187;.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u0410 \u043a\u0430\u043a \u0443 \u0432\u0430\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430? \u0414\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u043a\u0435\u0439\u0441\u0430\u043c\u0438 \u0438 \u0431\u043e\u043b\u044f\u043c\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/p>\n<\/blockquote>\n<hr\/>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/925612\/\"> https:\/\/habr.com\/ru\/articles\/925612\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-466355","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/466355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=466355"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/466355\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=466355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=466355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=466355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}