aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_commands.erl
diff options
context:
space:
mode:
authorMickael Remond <mremond@process-one.net>2016-03-30 14:23:09 +0200
committerMickael Remond <mremond@process-one.net>2016-03-30 14:23:09 +0200
commitead83b008c25e2619cbc7cfbf4bde5fb46c4e677 (patch)
tree94d4484df4b3041475e3ef94466ff3cae158fa4d /src/ejabberd_commands.erl
parentSupport flagging so Elixir tests as pending (diff)
HTTP ReST API now supports 'open' ejabberd commands
Diffstat (limited to '')
-rw-r--r--src/ejabberd_commands.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl
index 21872aa33..57285d6c6 100644
--- a/src/ejabberd_commands.erl
+++ b/src/ejabberd_commands.erl
@@ -212,6 +212,7 @@
list_commands/0,
get_command_format/1,
get_command_format/2,
+ get_command_policy/1,
get_command_definition/1,
get_tags_commands/0,
get_commands/0,
@@ -338,6 +339,17 @@ get_command_format(Name, Auth) ->
{Args, Result}
end.
+-spec get_command_policy(atom()) -> {ok, open|user|admin|restricted} | {error, command_not_found}.
+
+%% @doc return command policy.
+get_command_policy(Name) ->
+ case get_command_definition(Name) of
+ #ejabberd_commands{policy = Policy} ->
+ {ok, Policy};
+ command_not_found ->
+ {error, command_not_found}
+ end.
+
-spec get_command_definition(atom()) -> ejabberd_commands() | command_not_found.
%% @doc Get the definition record of a command.