No easy way to grant ALL players a privilege?
-
- Member
- Posts: 107
- Joined: Wed Jun 30, 2021 14:53
- GitHub: AmyMoriyama
No easy way to grant ALL players a privilege?
So, when I began my server I missed some privs to be given by default. Logically, you would think you could just do /grant all priv but this doesn't work and it seems the only way is to find the name of every player and grant each one the priv one at a time.
There has to be a better way, right?
There has to be a better way, right?
Re: No easy way to grant ALL players a privilege?
a ingame solution: you can place a commandblock from mesecons at spawn with a button. so you write "grant @nearest priv". (or something like that).
Re: No easy way to grant ALL players a privilege?
I made this script for someone else: viewtopic.php?f=10&t=26917
This is an automated bash script for granting all players on the server a specific privilege.
This works on a Linux system and you need to install the sqlite3 package that brings the sqlite3 command line program so I am assuming you know how to use the command line and that you have a Linux system available.
Copy this bash script code into a file and name it as you wish, make sure to make it executable with chmod:
Then copy this sqlite script into a file called "sql_cmd", note that you will have to change 'fly' for the privilege you want to grant, this is an example of granting fly:
Now you have to search your world directory for the file auth.sqlite, that is the database that holds the privilege and authentication data of players.
MAKE SURE TO BACKUP your auth.sqlite file before proceeding. After backing up, copy auth.sqlite and those two scripts into the same directory, get into that directory and run the bash script as "./name-of-your-script"
After running the script you can copy the auth.sqlite file that you just modified to your world directory and start your server.
Maybe there should be a feature similar to globbing on Linux shells for the Minetest command line.
This is an automated bash script for granting all players on the server a specific privilege.
This works on a Linux system and you need to install the sqlite3 package that brings the sqlite3 command line program so I am assuming you know how to use the command line and that you have a Linux system available.
Copy this bash script code into a file and name it as you wish, make sure to make it executable with chmod:
Code: Select all
#! /bin/bash
players=$(expr $(sqlite3 auth.sqlite ".dump auth" | wc -l) - 4)
for id in {1..${players}}
do
cat sql_cmd | sed "s/id/$id/" | sqlite3 auth.sqlite
mv auth.sqlite.tmp auth.sqlite
done
Code: Select all
INSERT INTO user_privileges VALUES (id, "fly");
.save auth.sqlite.tmp
.quit
MAKE SURE TO BACKUP your auth.sqlite file before proceeding. After backing up, copy auth.sqlite and those two scripts into the same directory, get into that directory and run the bash script as "./name-of-your-script"
After running the script you can copy the auth.sqlite file that you just modified to your world directory and start your server.
Maybe there should be a feature similar to globbing on Linux shells for the Minetest command line.
- Blockhead
- Member
- Posts: 1624
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: No easy way to grant ALL players a privilege?
There is a configuration setting to add privileges when new players join:
e.g.
default_privs = shout, fly, creative
Add the privs you want to your minetest.conf.
Minix has already posted the solution for upgrading your existing players.
e.g.
default_privs = shout, fly, creative
Add the privs you want to your minetest.conf.
Minix has already posted the solution for upgrading your existing players.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
- Linuxdirk
- Member
- Posts: 3218
- Joined: Wed Sep 17, 2014 11:21
- In-game: Linuxdirk
- Location: Germany
- Contact:
Re: No easy way to grant ALL players a privilege?
As far as I remember this is only relevant for players who never were on the server before, like, default_privs are only granted on first join.
- Blockhead
- Member
- Posts: 1624
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: No easy way to grant ALL players a privilege?
Correct. But that is why I added the second paragraph of my post:
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
-
- Member
- Posts: 107
- Joined: Wed Jun 30, 2021 14:53
- GitHub: AmyMoriyama
Re: No easy way to grant ALL players a privilege?
I like bash scripting, but that is not a solution. That solution only works under certain specific circumstances. Any solution should be able to be done on any platform that can host a server.
An idea, the default_privs could be expanded to do a simple check on player join. If player joins and has all the privs in the default_privs line, nothing is done. If any are missing, grant them. This would be an actual solution.
- Linuxdirk
- Member
- Posts: 3218
- Joined: Wed Sep 17, 2014 11:21
- In-game: Linuxdirk
- Location: Germany
- Contact:
Re: No easy way to grant ALL players a privilege?
Or add a mod that gives players the needed privileges when they join.
This would be platform-independent and you don’t need to manually mess with the database.
This would be platform-independent and you don’t need to manually mess with the database.
Who is online
Users browsing this forum: No registered users and 2 guests