MEDIUM: cli: store CLI level in the appctx
Store and check the level in the appctx in order to allow dynamic
permission changes over the CLI.
diff --git a/src/cli.c b/src/cli.c
index 0bb5bb0..adefcfa 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -381,10 +381,8 @@
*/
int cli_has_level(struct appctx *appctx, int level)
{
- struct stream_interface *si = appctx->owner;
- struct stream *s = si_strm(si);
- if ((strm_li(s)->bind_conf->level & ACCESS_LVL_MASK) < level) {
+ if ((appctx->cli_level & ACCESS_LVL_MASK) < level) {
appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg = stats_permission_denied_msg;
appctx->st0 = CLI_ST_PRINT;
@@ -563,6 +561,7 @@
/* reset severity to default at init */
appctx->cli_severity_output = bind_conf->severity_output;
appctx->st0 = CLI_ST_GETREQ;
+ appctx->cli_level = bind_conf->level;
}
else if (appctx->st0 == CLI_ST_END) {
/* Let's close for real now. We just close the request