From ead83b008c25e2619cbc7cfbf4bde5fb46c4e677 Mon Sep 17 00:00:00 2001 From: Mickael Remond Date: Wed, 30 Mar 2016 14:23:09 +0200 Subject: HTTP ReST API now supports 'open' ejabberd commands --- src/ejabberd_commands.erl | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/ejabberd_commands.erl') 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. -- cgit v1.2.3