Develop multi-user areas for LuCI

Continuing the discussion from Develop multi-user areas for LuCI:
I've reupload the package (upgraded): Link to download module

2 Likes

I'm trying to understand how it work.

edit the file:
/usr/lib/lua/luci/controller/admin/index.lua
and manually add the desired users here:

    page.sysauth = {"root", "tech"}
    page.sysauth_authenticator = "htmlauth"
    page.ucidata = true
    page.index = true
    page.target = firstnode()  ##--> This is the line where the error appears.

Place the module files in following paths:

/etc/config/nodes
/etc/config/users
/usr/lib/lua/luci/controller/admin/test.lua
/usr/lib/lua/luci/model/cbi/myapp-mymodule/manageusers.lua
/usr/lib/lua/luci/view/cbi/myapp/page_list.htm
/usr/lib/lua/luci/view/cbi/myapp/subpage_list.htm

It works sometimes, this is what I'm experiencing:

  • If I change the password from luci to any of the users it will stop working.

  • If I change the permissions on any of the users it will stop working.

  • Is there a way to apply changes to "/usr/lib/lua/luci/controller/admin/index.lua
    " without having to restart the router ? I have tried restarting uhttpd but it does not work.

  • Is there a way to add user to "/usr/lib/lua/luci/controller/admin/index.lua" without having to manually edit page.sysauth ?

  • Is there a way to allow creating users without adding them to /etc/shadow (using useradd) ?

  • is it required for the password in /etc/shadow to match the password /etc/config/users, if passwords need to match, why is it allowed to change the password in luci for users?

1 Like

Hello,

When i change the password from luci on "Manage Users" menu, the user password doesn't change on shadow. User can't login with new password, the old password is valid still for login.

Hi,
I'm sorry, but I haven't developed this feature (I've inserted in Manage Users page the possibility to show users password, because only root user can see them). But it was just a test. I wouldn't write the users clear password in a file! (at most encrypted password).

Login passed if password matches with /etc/shadow

Yes, of course; but it needs further development.

It doesn't effect because I haven't developed.

This is weird... Can you post the error?

I'm into getting involved in this because it's a feature needed to fully setup Samba from LuCI (they need to do more work with Samba itself).
Just one question...

Can you use GitHub? You can upload your patches there. It's way easier to have them updated, and provided the commit log you can download them directly from the repo, checkout, cherry pick, cool features!

In case anyone needs the direct download link for manage_users.zip: here it is

Hi @dennyv90,
I need to implement same kind of functionality in one of my project. So I am first trying things by installing OpenWrt as VM on VBox with version OpenWrt-19.07.0. Just wanted to know that : Does your changes are supported on this version (I am asking this because when I see the file /usr/lib/lua/luci/controller/admin/index.lua, I am not able to see the code block where changes needs to be done. So I suspect, might be this index.lua file gets changed with this version)? If Yes, could you please share the latest steps and the content to achieve this? I have read the whole thread but kind of confused over multiple replies and messages.

Thank you in advance!!!!

Hi,
sorry for awaiting.
I've test my module with the version 19.07.0 (I had also tested in the past and I remembered that it worked). I forgot that I needed to install luci-compat package.
The areas for users (non-root) still worked without luci-compat, but the page Manage Users crashes.

However, I prepared a virtual machine with:

  • OpenWrt 19.07.0
  • package installed (luci, luci-compat, curl, openssh-sftp-server, shadow-useradd)
  • network settings (VM nic Bridge mode, openwrt config lan DHCP)
  • 2 user (tech, user) -> passwords are same of username
  • load manage_users

This is the link of tar.gz archive containing VDI and vbox files

Bye

I confirm that on 19.07.3 doesn't work bacause LuCi approch is changed.
Dispatcher and index files present many differents respect to previous version of LuCi.
I think that this functionality exists yet on new LuCI (but I don't know how to use it).

However I uploaded a repo on my GitHub, so that the community can fix it for new LuCi or improved my module. Link to Github

Bye

Hi,
I just uploaded the project on my Github: https://github.com/denny-v90/openwrt-manage_users