add "only platform admin can create groups" and "only groups can create events" restrictions

This commit is contained in:
setop
2021-10-06 18:00:50 +02:00
committed by Thomas Citharel
parent 7885151220
commit 7940d69d5a
13 changed files with 135 additions and 34 deletions

View File

@@ -288,6 +288,9 @@ defmodule Mobilizon.Config do
end
end
# config :mobilizon, :groups, enabled: true
# config :mobilizon, :events, creation: true
@spec instance_group_feature_enabled? :: boolean
def instance_group_feature_enabled?,
do: :mobilizon |> Application.get_env(:groups) |> Keyword.get(:enabled)
@@ -303,6 +306,20 @@ defmodule Mobilizon.Config do
}
end
@spec only_admin_can_create_groups? :: boolean
def only_admin_can_create_groups?,
do:
:mobilizon
|> Application.get_env(:restrictions)
|> Keyword.get(:only_admin_can_create_groups)
@spec only_groups_can_create_events? :: boolean
def only_groups_can_create_events?,
do:
:mobilizon
|> Application.get_env(:restrictions)
|> Keyword.get(:only_groups_can_create_events)
@spec anonymous_actor_id :: integer
def anonymous_actor_id, do: get_cached_value(:anonymous_actor_id)
@spec relay_actor_id :: integer