diff --git a/lib/real_estate_web/live/property_live/index.html.leex b/lib/real_estate_web/live/property_live/index.html.leex
index 9f5c80c..712efba 100644
--- a/lib/real_estate_web/live/property_live/index.html.leex
+++ b/lib/real_estate_web/live/property_live/index.html.leex
@@ -28,9 +28,15 @@
<%= property.description %> |
- <%= live_redirect "Show", to: Routes.property_show_path(@socket, :show, property) %>
- <%= live_patch "Edit", to: Routes.property_index_path(@socket, :edit, property) %>
- <%= link "Delete", to: "#", phx_click: "delete", phx_value_id: property.id, data: [confirm: "Are you sure?"] %>
+ <%= if Roles.can?(@current_user, property, :show) do %>
+ <%= live_redirect "Show", to: Routes.property_show_path(@socket, :show, property) %>
+ <% end %>
+ <%= if Roles.can?(@current_user, property, :edit) do %>
+ <%= live_patch "Edit", to: Routes.property_index_path(@socket, :edit, property) %>
+ <% end %>
+ <%= if Roles.can?(@current_user, property, :delete) do %>
+ <%= link "Delete", to: "#", phx_click: "delete", phx_value_id: property.id, data: [confirm: "Are you sure?"] %>
+ <% end %>
|
<% end %>
diff --git a/lib/real_estate_web/live/property_live/show.html.leex b/lib/real_estate_web/live/property_live/show.html.leex
index a342993..9da9cf7 100644
--- a/lib/real_estate_web/live/property_live/show.html.leex
+++ b/lib/real_estate_web/live/property_live/show.html.leex
@@ -28,5 +28,9 @@
-<%= live_patch "Edit", to: Routes.property_show_path(@socket, :edit, @property), class: "button" %>
-<%= live_redirect "Back", to: Routes.property_index_path(@socket, :index) %>
+<%= if Roles.can?(@current_user, @property, :edit) do %>
+ <%= live_patch "Edit", to: Routes.property_show_path(@socket, :edit, @property), class: "button" %>
+<% end %>
+<%= if Roles.can?(@current_user, @property, :index) do %>
+ <%= live_redirect "Back", to: Routes.property_index_path(@socket, :index) %>
+<% end %>