Working basic frontend implementation
This commit is contained in:
@@ -303,6 +303,8 @@ defmodule Mixer.Accounts.User do
|
||||
has_many :valid_api_keys, Mixer.Accounts.ApiKey do
|
||||
filter expr(valid)
|
||||
end
|
||||
|
||||
has_many :tweets, Mixer.Posts.Tweet
|
||||
end
|
||||
|
||||
identities do
|
||||
|
||||
@@ -16,7 +16,7 @@ defmodule Mixer.Posts.Tweet do
|
||||
end
|
||||
|
||||
state_machine do
|
||||
initial_states [:drafted]
|
||||
initial_states [:drafted, :posted]
|
||||
default_initial_state :drafted
|
||||
|
||||
transitions do
|
||||
@@ -57,4 +57,18 @@ defmodule Mixer.Posts.Tweet do
|
||||
public? true
|
||||
end
|
||||
end
|
||||
|
||||
policies do
|
||||
policy action_type(:read) do
|
||||
authorize_if always()
|
||||
end
|
||||
|
||||
policy action_type(:create) do
|
||||
authorize_if actor_present()
|
||||
end
|
||||
|
||||
policy action_type([:destroy, :update]) do
|
||||
authorize_if relates_to_actor_via(:user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user