This commit is contained in:
Mayel de Borniol 2022-03-12 21:32:42 +13:00
parent 72f8e00635
commit 8935ecb3ed
3 changed files with 17 additions and 15 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
mix.lock merge=binary

View File

@ -18,6 +18,7 @@ verbs = %{
mention: %{id: "0EFERENC1NGTH1NGSE1SEWHERE", verb: "Mention"}, # mention a user or object.
tag: %{id: "4ATEG0R1S1NGNGR0VP1NGSTVFF", verb: "Tag"}, # tag a user or object in an object.
message: %{id: "40NTACTW1THAPR1VATEMESSAGE", verb: "Message"}, # send a direct message to the user.
request: %{id: "1NEEDPERM1SS10NT0D0TH1SN0W", verb: "Request"}, # request to do another verb (eg. request to follow)
}
all_verb_names = Enum.map(verbs, &elem(&1, 0))
@ -89,16 +90,17 @@ config :bonfire,
### (where values are assumed to be true).
grants: %{
### Public ACLs need their permissions filling out
guests_may_see_read: %{guest: [:read, :see]},
guests_may_see: %{guest: [:read]},
guests_may_read: %{guest: [:read]},
locals_may_interact: %{local: [:read, :see, :mention, :tag, :boost, :flag, :like, :follow]},
locals_may_reply: %{local: [:read, :see, :mention, :tag, :boost, :flag, :like, :follow, :reply]},
guests_may_see_read: %{guest: [:read, :see, :request]},
guests_may_see: %{guest: [:read, :request]},
guests_may_read: %{guest: [:read, :request]},
locals_may_interact: %{local: [:read, :see, :mention, :tag, :boost, :like, :follow, :request]}, # interact but not reply
locals_may_reply: %{local: [:read, :see, :mention, :tag, :boost, :like, :follow, :reply, :request]}, # interact and reply
# TODO: are we doing this because of instance-wide blocking?
nobody_can_anything: %{ghost_them: verbs_negative.(all_verb_names)},
nobody_can_reach: %{silence_them: verbs_negative.([:mention, :message, :reply])},
nobody_can_see: %{silence_me: verbs_negative.([:see])},
}
# end of global boundaries
negative_grants = [
:nobody_can_anything, :nobody_can_reach, :nobody_can_see, # instance-wide negative permissions

View File

@ -60,7 +60,7 @@ alias Bonfire.Data.Identity.{
}
alias Bonfire.Data.Social.{
Activity, Article, Block, Bookmark, Created, Feed, FeedPublish, Message, Follow,
Boost, Like, Flag, Mention, Post, PostContent, Profile, Replied,
Boost, Like, Flag, Mention, Post, PostContent, Profile, Replied, Request
}
alias Bonfire.Classify.Category
alias Bonfire.Geolocate.Geolocation
@ -81,10 +81,12 @@ alias Bonfire.{Tag, Tag.Tagged}
edge = quote do
has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id
has_many :activities, unquote(Activity), foreign_key: :object_id, references: :id
has_one :request, unquote(Request), foreign_key: :id, references: :id
end
edges = quote do
unquote(edge)
# has_one :edge, unquote(Edge), foreign_key: :id
has_one :created, unquote(Created), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
has_one :activity, unquote(Activity), foreign_key: :object_id, references: :id # requires an ON clause
end
@ -320,8 +322,6 @@ config :bonfire_data_social, FeedPublish, []
config :bonfire_data_social, Follow,
[code: quote do
has_one :created, unquote(Created), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
unquote(edges)
end]
# belongs_to: [follower_character: {Character, foreign_key: :follower_id, define_field: false}],
@ -336,24 +336,23 @@ config :bonfire_data_social, Block,
config :bonfire_data_social, Boost,
[code: quote do
has_one :created, unquote(Created), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
unquote(edges)
end]
# has_one: [activity: {Activity, foreign_key: :object_id, references: :boosted_id}] # requires an ON clause
config :bonfire_data_social, Like,
[code: quote do
has_one :created, unquote(Created), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
unquote(edges)
end]
# has_one: [activity: {Activity, foreign_key: :object_id, references: :liked_id}] # requires an ON clause
config :bonfire_data_social, Flag,
[code: quote do
has_one :created, unquote(Created), foreign_key: :id
has_one :caretaker, unquote(Caretaker), foreign_key: :id
unquote(edges)
end]
config :bonfire_data_social, Request,
[code: quote do
unquote(edges)
end]