Просмотр исходного кода

Merge pull request #38 from qor5/role-doc

Role doc
xuxinx 1 год назад
Родитель
Сommit
7e1f054038
42 измененных файлов с 462 добавлено и 21 удалено
  1. 4 0
      docs/advanced-functions/the-go-html-builder.html
  2. 4 0
      docs/appendix/all-demo-examples.html
  3. 4 0
      docs/basics/brand.html
  4. 4 0
      docs/basics/confirm-dialog.html
  5. 4 0
      docs/basics/event-handling.html
  6. 4 0
      docs/basics/filter.html
  7. 4 0
      docs/basics/form-handling.html
  8. 4 0
      docs/basics/layout-function-and-page-injector.html
  9. 4 0
      docs/basics/listing.html
  10. 4 0
      docs/basics/manipulate-page-url-in-event-func.html
  11. 4 0
      docs/basics/menu.html
  12. 4 0
      docs/basics/notification-center.html
  13. 4 0
      docs/basics/page-func-and-event-func.html
  14. 4 0
      docs/basics/partial-refresh-with-portal.html
  15. 4 0
      docs/basics/reload-page-with-a-flash.html
  16. 4 0
      docs/basics/scope-component.html
  17. 4 0
      docs/basics/shortcut.html
  18. 4 0
      docs/basics/summary-of-event-response.html
  19. 4 0
      docs/basics/switch-pages-with-push-state.html
  20. 4 0
      docs/components-guide/composite-new-component-with-go.html
  21. 4 0
      docs/components-guide/integrate-a-heavy-vue-component.html
  22. 4 0
      docs/getting-started/one-minute-quick-start.html
  23. 4 0
      docs/index.html
  24. 4 0
      docs/presets-guide/detail-page-for-complex-object.html
  25. 4 0
      docs/presets-guide/editing-customizations.html
  26. 4 0
      docs/presets-guide/its-the-whole-house.html
  27. 18 13
      docs/presets-guide/permissions.html
  28. 220 0
      docs/presets-guide/role.html
  29. 0 0
      docs/search_indexes.json
  30. 4 0
      docs/vuetify-components/a-taste-of-using-vuetify-in-go.html
  31. 4 0
      docs/vuetify-components/auto-complete.html
  32. 4 0
      docs/vuetify-components/basic-inputs.html
  33. 4 0
      docs/vuetify-components/lazy-portals.html
  34. 4 0
      docs/vuetify-components/linkage-select.html
  35. 5 3
      docsrc/content/basics/permissions.go
  36. 34 0
      docsrc/content/basics/role.go
  37. 1 0
      docsrc/doc_tree.go
  38. 2 2
      docsrc/examples/example_basics/permission.go
  39. 51 0
      docsrc/examples/example_basics/role.go
  40. 0 0
      docsrc/generated/examples-generated.go
  41. 3 3
      go.mod
  42. 4 0
      go.sum

+ 4 - 0
docs/advanced-functions/the-go-html-builder.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/appendix/all-demo-examples.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/brand.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/confirm-dialog.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/event-handling.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/filter.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/form-handling.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/layout-function-and-page-injector.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/listing.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/manipulate-page-url-in-event-func.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/menu.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/notification-center.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-blue-500'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/page-func-and-event-func.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/partial-refresh-with-portal.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/reload-page-with-a-flash.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/scope-component.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/shortcut.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/summary-of-event-response.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/basics/switch-pages-with-push-state.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/components-guide/composite-new-component-with-go.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/components-guide/integrate-a-heavy-vue-component.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/getting-started/one-minute-quick-start.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/index.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/presets-guide/detail-page-for-complex-object.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/presets-guide/editing-customizations.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/presets-guide/its-the-whole-house.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 18 - 13
docs/presets-guide/permissions.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-blue-500'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>
@@ -195,8 +199,8 @@ Use <code>SubjectsFunc</code> to fetch current subjects:</p>
 <h2><a name="able-effect" class="anchor" href="#able-effect" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>Able - Effect</h2>
 
 <ul>
-<li><code>:presets:users:1:</code></li>
-<li><code>*</code></li>
+<li>perm.Allowed</li>
+<li>perm.Denied</li>
 </ul>
 <h2><a name="what-action" class="anchor" href="#what-action" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>
 What - Action</h2>
@@ -204,11 +208,11 @@ What - Action</h2>
 <p>presets has a list of actions:</p>
 
 <ul>
-<li><code>ContextFunc</code></li>
-<li>%!s(MISSING)</li>
-<li>%!s(MISSING)</li>
-<li>%!s(MISSING)</li>
-<li>%!s(MISSING)</li>
+<li>presets.PermList</li>
+<li>presets.PermGet</li>
+<li>presets.PermCreate</li>
+<li>presets.PermUpdate</li>
+<li>presets.PermDelete</li>
 </ul>
 
 <p>And you can define other specific actions if needed.</p>
@@ -216,14 +220,15 @@ What - Action</h2>
 Something - Resource</h2>
 
 <p>An arbitrary unique resource name.<br>
-For example %!s(MISSING) represents the user record with id 1.<br>
-Use %!s(MISSING) as wildcard.</p>
+The presets builtin resource format is <code>:presets:mg_menu_group:uri:resource_rn:f_field:</code>.<br>
+For example <code>:presets:user_management:users:1:</code> represents the user record with id 1 under uri user_management.<br>
+Use <code>*</code> as wildcard.</p>
 <h2><a name="context-condition" class="anchor" href="#context-condition" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>
 Context - Condition</h2>
 
 <p>Optional.<br>
 The current context that containing condition information about the resource.<br>
-Use %!s(MISSING) to set the context:</p>
+Use <code>ContextFunc</code> to set the context:</p>
 
 <highlightjs :language='"go"' :code='"permBuilder.ContextFunc(func(r *http.Request, objs []interface{}) perm.Context {\n\tc := make(perm.Context)\n\tfor _, obj := range objs {\n\t\tswitch v := obj.(type) {\n\t\tcase resource1:\n\t\t\tc[\"owner\"] = v.Owner\n\t\t\t// ...other resource cases\n\t\t}\n\t}\n\treturn c\n})"'></highlightjs>
 <p>Policy uses <code>Given</code> to set conditions:</p>
@@ -234,7 +239,7 @@ Use %!s(MISSING) to set the context:</p>
 <p>Let&#39;s say there is a button on User detailing page used to ban the user. And only <code>super_admin</code> users have permission to execute this action.<br>
 First, create a verifier</p>
 
-<highlightjs :language='"go"' :code='"verifier := perm.NewVerifier(\"users\", presetsBuilder.GetPermission())"'></highlightjs>
+<highlightjs :language='"go"' :code='"verifier := perm.NewVerifier(\"module_users\", presetsBuilder.GetPermission())"'></highlightjs>
 <p>Then inject this verifier to relevant logic, such as</p>
 
 <ul>
@@ -246,7 +251,7 @@ First, create a verifier</p>
 <highlightjs :language='"go"' :code='"if verifier.Do(\"ban\").ObjectOn(user).WithReq(r).IsAllowed() == nil {\n\t// ui: show the ban button\n\t// action: can execute the ban action\n}"'></highlightjs>
 <p>Finally, add policy</p>
 
-<highlightjs :language='"go"' :code='"perm.PolicyFor(\"super_admin\").WhoAre(perm.Allowed).ToDo(\"ban\").On(\":users:*\")"'></highlightjs>
+<highlightjs :language='"go"' :code='"perm.PolicyFor(\"super_admin\").WhoAre(perm.Allowed).ToDo(\"ban\").On(\":module_users:*\")"'></highlightjs>
 <h2><a name="example" class="anchor" href="#example" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>Example</h2>
 
 <highlightjs :language='"go"' :code='"presetsBuilder.Permission(\n\tperm.New().Policies(\n\t\t// admin can do anything\n\t\tperm.PolicyFor(\"admin\").WhoAre(perm.Allowed).ToDo(perm.Anything).On(perm.Anything),\n\t\t// viewer can view anything except users\n\t\tperm.PolicyFor(\"viewer\").WhoAre(perm.Allowed).ToDo(presets.PermRead...).On(perm.Anything),\n\t\tperm.PolicyFor(\"viewer\").WhoAre(perm.Denied).ToDo(perm.Anything).On(\"*:users:*\"),\n\t\t// editor can edit their own articles\n\t\tperm.PolicyFor(\"editor\").WhoAre(perm.Allowed).ToDo(perm.Anything).On(\"*:articles:*\").Given(perm.Conditions{\n\t\t\t\"owner_id\": \u0026ladon.EqualsSubjectCondition{},\n\t\t}),\n\t).SubjectsFunc(func(r *http.Request) (ss []string) {\n\t\tuser := getCurrentUser(r)\n\t\tss = append(ss, user.ID)\n\t\tss = append(ss, user.Roles...)\n\t\treturn ss\n\t}).ContextFunc(func(r *http.Request, objs []interface{}) perm.Context {\n\t\tc := make(perm.Context)\n\t\tfor _, obj := range objs {\n\t\t\tswitch v := obj.(type) {\n\t\t\tcase *Article:\n\t\t\t\tc[\"owner_id\"] = v.OwnerID\n\t\t\t}\n\t\t}\n\t\treturn c\n\t}),\n)"'></highlightjs>
@@ -255,7 +260,7 @@ First, create a verifier</p>
 <highlightjs :language='"go"' :code='"perm.Verbose = true"'></highlightjs>
 <p>prints permission logs which is very helpful for debugging the permission policies:</p>
 
-<highlightjs :language='"plain"' :code='"\nhave permission: true, req: \u0026ladon.Request{Resource:\":presets:menu:articles:\", Action:\"presets:list\", Subject:\"viewer\", Context:ladon.Context(nil)}\nhave permission: true, req: \u0026ladon.Request{Resource:\":presets:articles:articles:1:\", Action:\"presets:update\", Subject:\"viewer\", Context:ladon.Context(nil)}\nhave permission: false, req: \u0026ladon.Request{Resource:\":presets:articles:articles:2:\", Action:\"presets:update\", Subject:\"viewer\", Context:ladon.Context(nil)}\n    "'></highlightjs>
+<highlightjs :language='"plain"' :code='"\nhave permission: true, req: \u0026ladon.Request{Resource:\":presets:articles:\", Action:\"presets:list\", Subject:\"viewer\", Context:ladon.Context(nil)}\nhave permission: true, req: \u0026ladon.Request{Resource:\":presets:articles:articles:1:\", Action:\"presets:update\", Subject:\"viewer\", Context:ladon.Context(nil)}\nhave permission: false, req: \u0026ladon.Request{Resource:\":presets:articles:articles:2:\", Action:\"presets:update\", Subject:\"viewer\", Context:ladon.Context(nil)}\n    "'></highlightjs>
 </div>
 </div>
 </div>

+ 220 - 0
docs/presets-guide/role.html

@@ -0,0 +1,220 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<title>Building Admin - Role - QOR5 Document</title>
+
+<meta name='description'>
+<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
+<base href='/docs/'>
+
+<link href='index.css' rel='stylesheet' type='text/css'>
+
+<script type='text/javascript' defer src='index.js'></script>
+</head>
+
+<body>
+<div id='app' v-cloak>
+<div v-init-context:vars='{hideAside: false}' class='flex h-screen'>
+<div class='flex-1 flex flex-col overflow-hidden'>
+<div class='flex h-full'>
+<aside v-show='!vars.hideAside' id='menuScroller' class='flex flex-col w-80 h-full bg-gray-50 border-r border-gray-200 overflow-y-auto'>
+<div class='h-12'><search></search></div>
+
+<ul class='px-0 py-3 mx-0 text-base font-normal list-none text-gray-700'>
+<li class='m-0'>
+<a href='index.html' id='index.html' onclick='window.storeMenuState("index.html")' class='inline-block px-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Introduction</a>
+</li>
+
+<li class='cursor-default px-4 py-1 truncate break-words w-64 m-0'>Getting Started</li>
+
+<li class='m-0'>
+<a href='getting-started/one-minute-quick-start.html' id='getting-started/one-minute-quick-start.html' onclick='window.storeMenuState("getting-started/one-minute-quick-start.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>1 Minute Quick Start</a>
+</li>
+
+<li class='cursor-default px-4 py-1 truncate break-words w-64 m-0'>Building Admin</li>
+
+<li class='m-0'>
+<a href='basics/listing.html' id='basics/listing.html' onclick='window.storeMenuState("basics/listing.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Listing</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/filter.html' id='basics/filter.html' onclick='window.storeMenuState("basics/filter.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Filters</a>
+</li>
+
+<li class='m-0'>
+<a href='presets-guide/editing-customizations.html' id='presets-guide/editing-customizations.html' onclick='window.storeMenuState("presets-guide/editing-customizations.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Editing</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/brand.html' id='basics/brand.html' onclick='window.storeMenuState("basics/brand.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Brand</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/menu.html' id='basics/menu.html' onclick='window.storeMenuState("basics/menu.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Menu</a>
+</li>
+
+<li class='m-0'>
+<a href='presets-guide/detail-page-for-complex-object.html' id='presets-guide/detail-page-for-complex-object.html' onclick='window.storeMenuState("presets-guide/detail-page-for-complex-object.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Detailing</a>
+</li>
+
+<li class='m-0'>
+<a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
+</li>
+
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-blue-500'>Role</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/shortcut.html' id='basics/shortcut.html' onclick='window.storeMenuState("basics/shortcut.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Keyboard Shortcut</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/confirm-dialog.html' id='basics/confirm-dialog.html' onclick='window.storeMenuState("basics/confirm-dialog.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Confirm Dialog</a>
+</li>
+
+<li class='cursor-default px-4 py-1 truncate break-words w-64 m-0'>Web Application</li>
+
+<li class='m-0'>
+<a href='basics/page-func-and-event-func.html' id='basics/page-func-and-event-func.html' onclick='window.storeMenuState("basics/page-func-and-event-func.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Page Func and Event Func</a>
+</li>
+
+<li class='m-0'>
+<a href='advanced-functions/the-go-html-builder.html' id='advanced-functions/the-go-html-builder.html' onclick='window.storeMenuState("advanced-functions/the-go-html-builder.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>The Go HTML builder</a>
+</li>
+
+<li class='m-0'>
+<a href='presets-guide/its-the-whole-house.html' id='presets-guide/its-the-whole-house.html' onclick='window.storeMenuState("presets-guide/its-the-whole-house.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Not just scaffolding, it&#39;s the whole house</a>
+</li>
+
+<li class='m-0'>
+<a href='vuetify-components/lazy-portals.html' id='vuetify-components/lazy-portals.html' onclick='window.storeMenuState("vuetify-components/lazy-portals.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Lazy Portals</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/layout-function-and-page-injector.html' id='basics/layout-function-and-page-injector.html' onclick='window.storeMenuState("basics/layout-function-and-page-injector.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Layout Function and Page Injector</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/switch-pages-with-push-state.html' id='basics/switch-pages-with-push-state.html' onclick='window.storeMenuState("basics/switch-pages-with-push-state.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Switch Pages with Push State</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/reload-page-with-a-flash.html' id='basics/reload-page-with-a-flash.html' onclick='window.storeMenuState("basics/reload-page-with-a-flash.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Reload Page with a Flash</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/partial-refresh-with-portal.html' id='basics/partial-refresh-with-portal.html' onclick='window.storeMenuState("basics/partial-refresh-with-portal.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Partial Refresh with Portal</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/manipulate-page-url-in-event-func.html' id='basics/manipulate-page-url-in-event-func.html' onclick='window.storeMenuState("basics/manipulate-page-url-in-event-func.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Manipulate Page URL in Event Func</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/summary-of-event-response.html' id='basics/summary-of-event-response.html' onclick='window.storeMenuState("basics/summary-of-event-response.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Summary of Event Response</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/scope-component.html' id='basics/scope-component.html' onclick='window.storeMenuState("basics/scope-component.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Scope Component</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/event-handling.html' id='basics/event-handling.html' onclick='window.storeMenuState("basics/event-handling.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Event Handling</a>
+</li>
+
+<li class='m-0'>
+<a href='basics/form-handling.html' id='basics/form-handling.html' onclick='window.storeMenuState("basics/form-handling.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Form Handling</a>
+</li>
+
+<li class='cursor-default px-4 py-1 truncate break-words w-64 m-0'>UI Components</li>
+
+<li class='m-0'>
+<a href='vuetify-components/basic-inputs.html' id='vuetify-components/basic-inputs.html' onclick='window.storeMenuState("vuetify-components/basic-inputs.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Basic Inputs</a>
+</li>
+
+<li class='m-0'>
+<a href='vuetify-components/a-taste-of-using-vuetify-in-go.html' id='vuetify-components/a-taste-of-using-vuetify-in-go.html' onclick='window.storeMenuState("vuetify-components/a-taste-of-using-vuetify-in-go.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>A Taste of using Vuetify in Go</a>
+</li>
+
+<li class='m-0'>
+<a href='vuetify-components/linkage-select.html' id='vuetify-components/linkage-select.html' onclick='window.storeMenuState("vuetify-components/linkage-select.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Linkage Select</a>
+</li>
+
+<li class='m-0'>
+<a href='vuetify-components/auto-complete.html' id='vuetify-components/auto-complete.html' onclick='window.storeMenuState("vuetify-components/auto-complete.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Auto Complete</a>
+</li>
+
+<li class='m-0'>
+<a href='components-guide/composite-new-component-with-go.html' id='components-guide/composite-new-component-with-go.html' onclick='window.storeMenuState("components-guide/composite-new-component-with-go.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Composite new Component With Go</a>
+</li>
+
+<li class='m-0'>
+<a href='components-guide/integrate-a-heavy-vue-component.html' id='components-guide/integrate-a-heavy-vue-component.html' onclick='window.storeMenuState("components-guide/integrate-a-heavy-vue-component.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Integrate a heavy Vue Component</a>
+</li>
+
+<li class='cursor-default px-4 py-1 truncate break-words w-64 m-0'>Appendix</li>
+
+<li class='m-0'>
+<a href='appendix/all-demo-examples.html' id='appendix/all-demo-examples.html' onclick='window.storeMenuState("appendix/all-demo-examples.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>All Demo Examples</a>
+</li>
+</ul>
+</aside>
+
+<main class='flex flex-col w-full bg-white overflow-x-hidden overflow-y-auto'>
+<div id='docContentBox' class='flex flex-row w-full'>
+<div class='flex flex-grow flex-col w-2/3'>
+<div class='flex flex-row'>
+<button @click='vars.hideAside = !vars.hideAside' class='w-12 h-12 p-4'>
+<div class='w-4 h-4 fill-current text-gray-300'>
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="16px" viewBox="0 0 16 16" version="1.1">
+<g id="surface1">
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 2 12 L 2 11 L 14 11 L 14 12 Z M 2 8.5 L 2 7.5 L 14 7.5 L 14 8.5 Z M 2 5 L 2 4 L 14 4 L 14 5 Z M 2 5 "/>
+</g>
+</svg>
+</div>
+</button>
+</div>
+
+<div id='docMainBox' class='px-16 pb-12 pt-4 overflow-auto'>
+<h1 class='mb-8'>Role</h1>
+
+<div class='border-t'><p><strong>Role</strong> provides a UI interface to manage roles(subjects) and their permissions.</p>
+
+<p>1.  enable permission DBPolicy</p>
+
+<highlightjs :language='"go"' :code='"perm.New().\n\tPolicies(\n\t// static policies\n\t).\n\tDBPolicy(perm.NewDBPolicy(db))"'></highlightjs>
+<p>2. configure role<br>
+set resources that you want to manage on interface</p>
+
+<highlightjs :language='"go"' :code='"rb := role.New(db).\n\tResources([]*vuetify.DefaultOptionItem{\n\t\t{Text: \"All\", Value: \"*\"},\n\t\t{Text: \"Posts\", Value: \"*:posts:*\"},\n\t\t{Text: \"Customers\", Value: \"*:customers:*\"},\n\t\t{Text: \"Products\", Value: \"*:products:*\"},\n\t})"'></highlightjs>
+<p>(optional) set actions, the default value is the following</p>
+
+<highlightjs :language='"go"' :code='"// default value\nrb.Actions([]*vuetify.DefaultOptionItem{\n\t{Text: \"All\", Value: \"*\"},\n\t{Text: \"List\", Value: presets.PermList},\n\t{Text: \"Get\", Value: presets.PermGet},\n\t{Text: \"Create\", Value: presets.PermCreate},\n\t{Text: \"Update\", Value: presets.PermUpdate},\n\t{Text: \"Delete\", Value: presets.PermDelete},\n})"'></highlightjs>
+<p>(optional) set editor subject to set who can edit <strong>Role</strong></p>
+
+<highlightjs :language='"go"' :code='"rb.EditorSubject(\"RoleEditor\")"'></highlightjs>
+<p>attach role to presets builder</p>
+
+<highlightjs :language='"go"' :code='"rb.Configure(presetsBuilder)"'></highlightjs>
+</div>
+</div>
+</div>
+
+<div class='font-medium text-base hidden xl:block text-gray-600 pt-4'>
+<div class='sticky top-4 w-52'>On This Page<toc></toc></div>
+</div>
+</div>
+<search-result></search-result></main>
+</div>
+</div>
+</div>
+</div>
+</body>
+</html>

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
docs/search_indexes.json


+ 4 - 0
docs/vuetify-components/a-taste-of-using-vuetify-in-go.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/vuetify-components/auto-complete.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/vuetify-components/basic-inputs.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/vuetify-components/lazy-portals.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 4 - 0
docs/vuetify-components/linkage-select.html

@@ -62,6 +62,10 @@
 <a href='presets-guide/permissions.html' id='presets-guide/permissions.html' onclick='window.storeMenuState("presets-guide/permissions.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Permissions</a>
 </li>
 
+<li class='m-0'>
+<a href='presets-guide/role.html' id='presets-guide/role.html' onclick='window.storeMenuState("presets-guide/role.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Role</a>
+</li>
+
 <li class='m-0'>
 <a href='basics/notification-center.html' id='basics/notification-center.html' onclick='window.storeMenuState("basics/notification-center.html")' class='inline-block pl-10 pr-4 py-1 truncate break-words w-64 hover:text-blue-400 text-gray-700'>Notification Center</a>
 </li>

+ 5 - 3
docsrc/content/basics/permissions.go

@@ -38,7 +38,8 @@ presets has a list of actions:
 And you can define other specific actions if needed.
 ## Something - Resource
 An arbitrary unique resource name.  
-For example %s represents the user record with id 1.  
+The presets builtin resource format is %s.  
+For example %s represents the user record with id 1 under uri user_management.  
 Use %s as wildcard.
 ## Context - Condition
 Optional.  
@@ -52,7 +53,8 @@ Use %s to set the context:
 		strings.TrimRight(generated.PermissionPermCreate, ","),
 		strings.TrimRight(generated.PermissionPermUpdate, ","),
 		strings.TrimRight(generated.PermissionPermDelete, ","),
-		"`:presets:users:1:`",
+		"`:presets:mg_menu_group:uri:resource_rn:f_field:`",
+		"`:presets:user_management:users:1:`",
 		"`*`",
 		"`ContextFunc`",
 	)),
@@ -89,7 +91,7 @@ Finally, add policy
 prints permission logs which is very helpful for debugging the permission policies:
     `),
 	ch.Code(`
-have permission: true, req: &ladon.Request{Resource:":presets:menu:articles:", Action:"presets:list", Subject:"viewer", Context:ladon.Context(nil)}
+have permission: true, req: &ladon.Request{Resource:":presets:articles:", Action:"presets:list", Subject:"viewer", Context:ladon.Context(nil)}
 have permission: true, req: &ladon.Request{Resource:":presets:articles:articles:1:", Action:"presets:update", Subject:"viewer", Context:ladon.Context(nil)}
 have permission: false, req: &ladon.Request{Resource:":presets:articles:articles:2:", Action:"presets:update", Subject:"viewer", Context:ladon.Context(nil)}
     `).Language("plain"),

+ 34 - 0
docsrc/content/basics/role.go

@@ -0,0 +1,34 @@
+package basics
+
+import (
+	"github.com/qor5/docs/docsrc/generated"
+	. "github.com/theplant/docgo"
+	"github.com/theplant/docgo/ch"
+)
+
+var Role = Doc(
+	Markdown(`
+**Role** provides a UI interface to manage roles(subjects) and their permissions.  
+
+1\.  enable permission DBPolicy
+    `),
+	ch.Code(generated.RolePermEnableDBPolicy).Language("go"),
+	Markdown(`
+2\. configure role  
+set resources that you want to manage on interface
+    `),
+	ch.Code(generated.RoleSetResources).Language("go"),
+	Markdown(`
+(optional) set actions, the default value is the following 
+    `),
+	ch.Code(generated.RoleSetActions).Language("go"),
+	Markdown(`
+(optional) set editor subject to set who can edit **Role**
+    `),
+	ch.Code(generated.RoleSetEditorSubject).Language("go"),
+	Markdown(`
+attach role to presets builder
+    `),
+	ch.Code(generated.RoleAttachToPresetsBuilder).Language("go"),
+).Title("Role").
+	Slug("presets-guide/role")

+ 1 - 0
docsrc/doc_tree.go

@@ -33,6 +33,7 @@ var DocTree = []interface{}{
 			advanced_functions.DetailPageForComplexObject,
 			// permission
 			basics.Permissions,
+			basics.Role,
 			// other basics
 			basics.NotificationCenter,
 			basics.ShortCut,

+ 2 - 2
docsrc/examples/example_basics/permission.go

@@ -116,7 +116,7 @@ func permissionPieces() {
 	var r *http.Request
 	var user interface{}
 	// @snippet_begin(PermissionNewVerifier)
-	verifier := perm.NewVerifier("users", presetsBuilder.GetPermission())
+	verifier := perm.NewVerifier("module_users", presetsBuilder.GetPermission())
 	// @snippet_end
 	// @snippet_begin(PermissionVerifierCheck)
 	if verifier.Do("ban").ObjectOn(user).WithReq(r).IsAllowed() == nil {
@@ -125,6 +125,6 @@ func permissionPieces() {
 	}
 	// @snippet_end
 	// @snippet_begin(PermissionAddCustomPolicy)
-	perm.PolicyFor("super_admin").WhoAre(perm.Allowed).ToDo("ban").On(":users:*")
+	perm.PolicyFor("super_admin").WhoAre(perm.Allowed).ToDo("ban").On(":module_users:*")
 	// @snippet_end
 }

+ 51 - 0
docsrc/examples/example_basics/role.go

@@ -0,0 +1,51 @@
+package example_basics
+
+import (
+	"github.com/qor5/admin/presets"
+	"github.com/qor5/admin/role"
+	"github.com/qor5/ui/vuetify"
+	"github.com/qor5/x/perm"
+	"gorm.io/gorm"
+)
+
+func rolePieces() {
+	var db *gorm.DB
+	// @snippet_begin(RolePermEnableDBPolicy)
+	perm.New().
+		Policies(
+		// static policies
+		).
+		DBPolicy(perm.NewDBPolicy(db))
+		// @snippet_end
+
+		// @snippet_begin(RoleSetResources)
+	rb := role.New(db).
+		Resources([]*vuetify.DefaultOptionItem{
+			{Text: "All", Value: "*"},
+			{Text: "Posts", Value: "*:posts:*"},
+			{Text: "Customers", Value: "*:customers:*"},
+			{Text: "Products", Value: "*:products:*"},
+		})
+	// @snippet_end
+
+	// @snippet_begin(RoleSetActions)
+	// default value
+	rb.Actions([]*vuetify.DefaultOptionItem{
+		{Text: "All", Value: "*"},
+		{Text: "List", Value: presets.PermList},
+		{Text: "Get", Value: presets.PermGet},
+		{Text: "Create", Value: presets.PermCreate},
+		{Text: "Update", Value: presets.PermUpdate},
+		{Text: "Delete", Value: presets.PermDelete},
+	})
+	// @snippet_end
+
+	// @snippet_begin(RoleSetEditorSubject)
+	rb.EditorSubject("RoleEditor")
+	// @snippet_end
+
+	var presetsBuilder *presets.Builder
+	// @snippet_begin(RoleAttachToPresetsBuilder)
+	rb.Configure(presetsBuilder)
+	// @snippet_end
+}

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
docsrc/generated/examples-generated.go


+ 3 - 3
go.mod

@@ -8,10 +8,10 @@ require (
 	github.com/go-chi/chi v1.5.4
 	github.com/manifoldco/promptui v0.9.0
 	github.com/qor/oss v0.0.0-20210412121326-3c5583a62015
-	github.com/qor5/admin v0.0.0-20230227013111-715f9fd3421a
+	github.com/qor5/admin v0.0.0-20230309055501-c8d08dc6944b
 	github.com/qor5/ui v1.0.1-0.20221212071205-e794612c1e84
 	github.com/qor5/web v1.2.4-0.20221109035751-adf9bf246c1e
-	github.com/qor5/x v1.2.1-0.20230215023713-a028537191cc
+	github.com/qor5/x v1.2.1-0.20230308023320-5dd0a2f09c49
 	github.com/shurcooL/sanitized_anchor_name v1.0.0
 	github.com/sunfmin/reflectutils v1.0.3
 	github.com/theplant/docgo v0.0.15
@@ -56,7 +56,7 @@ require (
 	github.com/jinzhu/now v1.1.5 // indirect
 	github.com/jmespath/go-jmespath v0.4.0 // indirect
 	github.com/lib/pq v1.10.7 // indirect
-	github.com/markbates/goth v1.75.1 // indirect
+	github.com/markbates/goth v1.76.0 // indirect
 	github.com/mattn/go-colorable v0.1.9 // indirect
 	github.com/mattn/go-isatty v0.0.14 // indirect
 	github.com/mattn/go-sqlite3 v1.14.16 // indirect

+ 4 - 0
go.sum

@@ -261,6 +261,7 @@ github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GW
 github.com/markbates/going v1.0.0/go.mod h1:I6mnB4BPnEeqo85ynXIx1ZFLLbtiLHNXVgWeFO9OGOA=
 github.com/markbates/goth v1.75.1 h1:x+0vP1GBBj+Si6ChLTMW1sF7FDn8myLVJYMoS+9+cHk=
 github.com/markbates/goth v1.75.1/go.mod h1:X6xdNgpapSENS0O35iTBBcMHoJDQDfI9bJl+APCkYMc=
+github.com/markbates/goth v1.76.0/go.mod h1:X6xdNgpapSENS0O35iTBBcMHoJDQDfI9bJl+APCkYMc=
 github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
 github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
 github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
@@ -302,6 +303,8 @@ github.com/qor5/admin v0.0.0-20230224100402-af6e5e15c108 h1:PwvBGGV6JXMvRhRKr2Xc
 github.com/qor5/admin v0.0.0-20230224100402-af6e5e15c108/go.mod h1:UhmKyOUDo/2iNxVu2y9+8IGSgLj9HvxTfSsSC/VkgnM=
 github.com/qor5/admin v0.0.0-20230227013111-715f9fd3421a h1:nL6kJnmkmNc3Ryw3tPShuiVReN/B9XMGGHUjeqZKcGQ=
 github.com/qor5/admin v0.0.0-20230227013111-715f9fd3421a/go.mod h1:UhmKyOUDo/2iNxVu2y9+8IGSgLj9HvxTfSsSC/VkgnM=
+github.com/qor5/admin v0.0.0-20230309055501-c8d08dc6944b h1:j9wGiuweDoSAVxBH/+zAKS3wrkijmVWODnvpCIKnYJE=
+github.com/qor5/admin v0.0.0-20230309055501-c8d08dc6944b/go.mod h1:cTtdZJvUGLNTGFfe53xT1H5noFgawFbfHsBLJyKEZYs=
 github.com/qor5/ui v1.0.0 h1:9npS/FvnlR2j7Z8uGW69511oLbHad+LOLDNob7jJj2Y=
 github.com/qor5/ui v1.0.0/go.mod h1:bgBqjIytHRdfTsiZea8df/ltAcyQyuHiLbecgo8Iwgw=
 github.com/qor5/ui v1.0.1-0.20221212071205-e794612c1e84/go.mod h1:bgBqjIytHRdfTsiZea8df/ltAcyQyuHiLbecgo8Iwgw=
@@ -310,6 +313,7 @@ github.com/qor5/web v1.2.4-0.20221109035751-adf9bf246c1e/go.mod h1:gwAoUC1cQ9y5V
 github.com/qor5/x v1.2.1-0.20221109065533-3e5f9b440cb3 h1:4W5ix5ep3JJQSJwBMjyXLskaOHUy2vfd1aPDt4xtVU0=
 github.com/qor5/x v1.2.1-0.20221109065533-3e5f9b440cb3/go.mod h1:pqE7TSENrUKHlwzDSdaww0pk3E9X1ffoqAfCHzoZrJk=
 github.com/qor5/x v1.2.1-0.20230215023713-a028537191cc/go.mod h1:pqE7TSENrUKHlwzDSdaww0pk3E9X1ffoqAfCHzoZrJk=
+github.com/qor5/x v1.2.1-0.20230308023320-5dd0a2f09c49/go.mod h1:pqE7TSENrUKHlwzDSdaww0pk3E9X1ffoqAfCHzoZrJk=
 github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be h1:ta7tUOvsPHVHGom5hKW5VXNc2xZIkfCKP8iaqOyYtUQ=
 github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be/go.mod h1:MIDFMn7db1kT65GmV94GzpX9Qdi7N/pQlwb+AN8wh+Q=
 github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=

Некоторые файлы не были показаны из-за большого количества измененных файлов