usermngr: Added full_access and Untrusted role

This commit is contained in:
Vivek Kumar Dutta 2025-02-26 17:30:41 +05:30
parent c1a8c1aa86
commit af3cf465bc
3 changed files with 13 additions and 4 deletions

View file

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=usermngr PKG_NAME:=usermngr
PKG_VERSION:=1.3.3 PKG_VERSION:=1.3.4
LOCAL_DEV:=0 LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)

View file

@ -5,3 +5,13 @@ config user 'admin'
config user 'user' config user 'user'
option enabled '1' option enabled '1'
option remote_access '1' option remote_access '1'
config role 'full_access'
option enabled '1'
option role_id '1'
option name 'full_access'
config role 'untrusted'
option enabled '1'
option role_id '2'
option name 'Untrusted'

View file

@ -10,10 +10,10 @@ add_system_shells() {
# Add the shell in UCI if not exists # Add the shell in UCI if not exists
sec=$(uci -q show users | grep -E "^users\.@shell\[[0-9]+\]\.name=\'$shell_name\'$") sec=$(uci -q show users | grep -E "^users\.@shell\[[0-9]+\]\.name=\'$shell_name\'$")
if [ -z "${sec}" ]; then if [ -z "${sec}" ]; then
sec=$(uci -q add users shell) sec="shell_${shell_name}"
uci -q set users."${sec}"=shell
uci -q set users."${sec}".name="${shell_name}" uci -q set users."${sec}".name="${shell_name}"
uci -q set users."${sec}.enabled=1" uci -q set users."${sec}.enabled=1"
uci commit users
fi fi
done done
} }
@ -60,4 +60,3 @@ remove_shell() {
config_load users config_load users
add_system_shells add_system_shells
config_foreach remove_shell shell config_foreach remove_shell shell
uci commit users