To decide show sidebar item to user, we need to check user's permission on project. We check one by one, but I don't want it. It runs a query for each check. I made `actions` argument optional in our authorization query. If it's not provided, it returns all matched policies that user has permission on given object. So we can fetch this list once, and check permission from it. Also we don't show create buttons if user doesn't have create permission for Vm or Private Subnet. Fixes #436
11 lines
428 B
Text
11 lines
428 B
Text
<% if !defined?(has_permission) || has_permission%>
|
|
<li>
|
|
<a
|
|
href="<%= url %>"
|
|
class="<%= is_active ? "bg-orange-700 text-white" : "text-orange-100 hover:text-white hover:bg-orange-700" %> group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold"
|
|
>
|
|
<%== render("components/icon", locals: { name: icon, classes: "h-6 w-6 shrink-0 text-white" }) %>
|
|
<%= name %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|