Introduce admin and moderator role, check role on list_users action
Signed-off-by: Thomas Citharel <tcit@tcit.fr> Add test for guards
This commit is contained in:
@@ -31,3 +31,13 @@ defmodule Mobilizon.Users.Service.Tools do
|
||||
|> Base.url_encode64()
|
||||
end
|
||||
end
|
||||
|
||||
defmodule Mobilizon.Users.Guards do
|
||||
@moduledoc """
|
||||
Guards for users
|
||||
"""
|
||||
|
||||
defguard is_admin(role) when is_atom(role) and role == :administrator
|
||||
|
||||
defguard is_moderator(role) when is_atom(role) and role in [:administrator, :moderator]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user