UNPKG

@superawesome/permissions-nestjs

Version:

NestJS Guard & Decorators for @superawesome/permissions, promoting orthogonal fine-grained API access control to resources.

125 lines (92 loc) 6.35 kB
<!doctype html> <html class="no-js" lang=""> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>SuperAwesome Permissions for NestJs (@superawesome/permissions-nestjs)</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="../images/favicon.ico"> <link rel="stylesheet" href="../styles/style.css"> <link rel="stylesheet" href="../styles/postmark.css"> </head> <body> <div class="navbar navbar-default navbar-fixed-top visible-xs"> <a href="../" class="navbar-brand">SuperAwesome Permissions for NestJs (@superawesome/permissions-nestjs)</a> <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button> </div> <div class="xs-menu menu" id="mobile-menu"> <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu> </div> <div class="container-fluid main"> <div class="row main"> <div class="hidden-xs menu"> <compodoc-menu mode="normal"></compodoc-menu> </div> <!-- START CONTENT --> <div class="content additional-page"> <div class="content-data"> <h1 id="superawesome-permissions-for-nestjs-guard--decorators">SuperAwesome Permissions for NestJS Guard &amp; Decorators</h1> <h2 id="introduction">Introduction</h2> <p>SuperAwesome Permissions for NestJS is where the project shines &amp; shows its orthogonal &amp; Aspect Oriented architecture. It provides <strong>full support</strong> and <strong>seamless integration</strong> for: </p> <ul> <li><p><a href="https://permissions.docs.superawesome.com">SuperAwesome Permissions library</a>, including <a href="https://permissions.docs.superawesome.com/classes/PermissionDefinition.html">PermissionDefinitions</a>, ownership hooks and method injection of the automatically created <a href="https://permissions.docs.superawesome.com/classes/Permit.html">Permit object</a> to accompany every request&#39;s lifetime. </p> </li> <li><p>The <a href="https://docs.nestjs.com/guards">NestJS Guard architecture</a>, using the deceptively simple <a href="/miscellaneous/variables.html#createPermissionsGuard">createPermissionsGuard factory function</a> to declaratively configure a specific controller&#39;s Guard, passed into nestjs&#39;s <code>@UseGuards</code>. </p> <p>The Guard is <strong>actively allowing or forbidding access to every method/endpoint</strong> of your controller, before the method is even executed (if that makes sense). </p> <p>The declarative and DRY nature is achieved by the use decorators &amp; <strong>introspecting and extracting all possible information</strong> from your existing code &amp; runtime, making the whole Authorization (i.e Permissions) architecture <a href="https://en.wikipedia.org/wiki/Aspect-oriented_programming">aspect oriented</a> &amp; almost completely <a href="https://en.wikipedia.org/wiki/Orthogonality_(programming)">orthogonal</a> to your application. </p> </li> </ul> <h2 id="how-to-use">How to use</h2> <p>First, you need to understand the basics of <a href="https://permissions.docs.superawesome.com/additional-documentation/introduction-&amp;-glossary.html">how SuperAwesome Permissions works</a>. </p> <p>Then please continue to: </p> <ul> <li><p><a href="/additional-documentation/how-to-use-simple-example.html">How to use &amp; simple example</a> for a quick overview and how to use in the most simple &amp; declarative example. </p> </li> <li><p>Then move on to a <a href="/additional-documentation/reference-&amp;-detailed-example.html">detailed example which is also the reference</a>.</p> </li> </ul> <h2 id="how-to-install--configure">How to install &amp; configure</h2> <p>To install simply:</p> <div><pre class="line-numbers"><code class="language-bash"> $ npm install &#64;superawesome/permissions &#64;superawesome/permissions-nestjs --save</code></pre></div><p>Make sure <code>@superawesome/permissions</code> version is the right one (as in its <code>peerDependencies</code>). </p> </div><div class="search-results"> <div class="has-results"> <h1 class="search-results-title"><span class='search-results-count'></span> result-matching "<span class='search-query'></span>"</h1> <ul class="search-results-list"></ul> </div> <div class="no-results"> <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1> </div> </div> </div> <!-- END CONTENT --> </div> </div> <script> var COMPODOC_CURRENT_PAGE_DEPTH = 1; var COMPODOC_CURRENT_PAGE_CONTEXT = 'additional-page'; var COMPODOC_CURRENT_PAGE_URL = 'introduction.html'; </script> <script src="../js/libs/custom-elements.min.js"></script> <script src="../js/libs/lit-html.js"></script> <!-- Required to polyfill modern browsers as code is ES5 for IE... --> <script src="../js/libs/custom-elements-es5-adapter.js" charset="utf-8" defer></script> <script src="../js/menu-wc.js" defer></script> <script src="../js/libs/bootstrap-native.js"></script> <script src="../js/libs/es6-shim.min.js"></script> <script src="../js/libs/EventDispatcher.js"></script> <script src="../js/libs/promise.min.js"></script> <script src="../js/libs/zepto.min.js"></script> <script src="../js/compodoc.js"></script> <script src="../js/tabs.js"></script> <script src="../js/menu.js"></script> <script src="../js/libs/clipboard.min.js"></script> <script src="../js/libs/prism.js"></script> <script src="../js/sourceCode.js"></script> <script src="../js/search/search.js"></script> <script src="../js/search/lunr.min.js"></script> <script src="../js/search/search-lunr.js"></script> <script src="../js/search/search_index.js"></script> <script src="../js/lazy-load-graphs.js"></script> </body> </html>