Ролевая модель и аудит Часть 1.
This commit is contained in:
13
src/infra/admin_utils.erl
Normal file
13
src/infra/admin_utils.erl
Normal file
@@ -0,0 +1,13 @@
|
||||
-module(admin_utils).
|
||||
-include("records.hrl").
|
||||
|
||||
-export([is_admin/1]).
|
||||
|
||||
is_admin(UserId) ->
|
||||
case core_admin:get_by_id(UserId) of
|
||||
{ok, User} ->
|
||||
Role = User#admin.role,
|
||||
Role =:= admin orelse Role =:= superadmin orelse
|
||||
Role =:= moderator orelse Role =:= support;
|
||||
_ -> false
|
||||
end.
|
||||
Reference in New Issue
Block a user