diff options
author | Mickaël Rémond <mickael.remond@process-one.net> | 2016-03-31 11:37:14 +0200 |
---|---|---|
committer | Mickaël Rémond <mickael.remond@process-one.net> | 2016-03-31 11:37:14 +0200 |
commit | 7c2998a55d78d1345b706192c55a9d03c649c38a (patch) | |
tree | b092154b65f17eedc5a90e2e7576ca1d44c09cca /src/ejabberd_commands.erl | |
parent | mix version updated for 16.03 release (diff) | |
parent | Fix Dialyzer inconsistency (diff) |
Merge pull request #1044 from processone/http-api
Add ability to call open ejabberd commands through ReST API
Diffstat (limited to 'src/ejabberd_commands.erl')
-rw-r--r-- | src/ejabberd_commands.erl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl index 21872aa3..57285d6c 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. |