Update the formating for Publisher resource.
This commit is contained in:
@@ -9,28 +9,6 @@ defmodule DecentralisedBookIndex.Metadata.Publisher do
|
|||||||
require Ash.Query
|
require Ash.Query
|
||||||
alias DecentralisedBookIndex.Metadata
|
alias DecentralisedBookIndex.Metadata
|
||||||
|
|
||||||
policies do
|
|
||||||
bypass actor_attribute_equals(:role, :admin) do
|
|
||||||
authorize_if always()
|
|
||||||
end
|
|
||||||
|
|
||||||
policy action_type(:read) do
|
|
||||||
authorize_if always()
|
|
||||||
end
|
|
||||||
|
|
||||||
policy action_type(:create) do
|
|
||||||
authorize_if actor_attribute_equals(:role, :moderator)
|
|
||||||
end
|
|
||||||
|
|
||||||
policy action_type(:update) do
|
|
||||||
authorize_if actor_attribute_equals(:role, :moderator)
|
|
||||||
end
|
|
||||||
|
|
||||||
policy action_type(:destroy) do
|
|
||||||
authorize_if actor_attribute_equals(:role, :admin)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
json_api do
|
json_api do
|
||||||
type "publisher"
|
type "publisher"
|
||||||
end
|
end
|
||||||
@@ -79,6 +57,28 @@ defmodule DecentralisedBookIndex.Metadata.Publisher do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
policies do
|
||||||
|
bypass actor_attribute_equals(:role, :admin) do
|
||||||
|
authorize_if always()
|
||||||
|
end
|
||||||
|
|
||||||
|
policy action_type(:read) do
|
||||||
|
authorize_if always()
|
||||||
|
end
|
||||||
|
|
||||||
|
policy action_type(:create) do
|
||||||
|
authorize_if actor_attribute_equals(:role, :moderator)
|
||||||
|
end
|
||||||
|
|
||||||
|
policy action_type(:update) do
|
||||||
|
authorize_if actor_attribute_equals(:role, :moderator)
|
||||||
|
end
|
||||||
|
|
||||||
|
policy action_type(:destroy) do
|
||||||
|
authorize_if actor_attribute_equals(:role, :admin)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
attributes do
|
attributes do
|
||||||
uuid_primary_key :id, writable?: true
|
uuid_primary_key :id, writable?: true
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ defmodule DecentralisedBookIndex.Metadata.Publisher do
|
|||||||
public? true
|
public? true
|
||||||
end
|
end
|
||||||
|
|
||||||
timestamps() do
|
timestamps do
|
||||||
writable? true
|
writable? true
|
||||||
public? true
|
public? true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user