hexparrot / mineos-node

node.js implementation of mineos minecraft management
GNU General Public License v3.0
334 stars 170 forks source link

Disable "Host Settings" for custom users #184

Closed zefie closed 8 years ago

zefie commented 8 years ago

I'm looking to allow a few users to control their own servers, but don't want to let them create new ones. Is there a way to disable the entire "Host Settings" section if the user != "root" or "mc"?

(BTW I tried to post on your forum but I cannot sign up because it says the admin has disabled email)

hexparrot commented 8 years ago

Alright, so go ahead and switch to the following branch "custom_user". This should allow you to whitelist users who are allowed to create new servers; only server creation is affected--all other functionality is left untouched.

cd /usr/games/minecraft
git fetch
git checkout custom_user
npm install

And then restart your webui. Depending on how you installed it, it could be supervisorctl restart mineos. You can whitelist users by adding the following to your /etc/mineos.conf

creators = root,mc,will

This line will be left out of normal installs, so that all logged-in users can create. Once creators = is present, only users present in this line may create (creators = mc would still prohibit root)

zefie commented 8 years ago

root@mineos /home/mc# cd /usr/games/minecraft/ root@mineos games/minecraft# git fetch remote: Counting objects: 5, done. remote: Compressing objects: 100% (4/4), done. remote: Total 5 (delta 4), reused 2 (delta 1), pack-reused 0 Unpacking objects: 100% (5/5), done. From https://github.com/hexparrot/mineos-node bcb4bd5..2d22dc1 master -> origin/master root@mineos games/minecraft# git checkout origin custom_user error: pathspec 'custom_user' did not match any file(s) known to git.

hexparrot commented 8 years ago

My mistake "origin" shouldn't be part of that command.

zefie commented 8 years ago

Same error though :(

Edit: got it, thanks :) git fetch origin custom_user git checkout -b origin/custom_user

Though oddly I can't get it to act any differently, even after adding the new creators config to /etc/mineos.conf .. I set creators = root,mc but other users can still create a server. Log doesn't seem to mention any errors, or anything at all about the new config option.

hexparrot commented 8 years ago

Did you restart the server so that the new files are used?

Did you also run the npm install command mentioned above?

Depending on how you installed MineOS, it's likely supervisorctl restart mineos

Here's the output I got when using the commands as I gave you--your fetch and checkout commands probably shouldn't look like that.

will@willonubuntu:~/mineos-node$ git fetch
will@willonubuntu:~/mineos-node$ git checkout custom_user
Switched to branch 'custom_user'
Your branch is up-to-date with 'origin/custom_user'.
zefie commented 8 years ago

I just removed /usr/games/minecraft and re-cloned it and your original commands worked.

hexparrot commented 8 years ago

Has this branch solved your issue?

zefie commented 8 years ago

Sorta, yeah. I think it would still be a neat option to remove the entire host section. But I will close this. :)