[Mod] Temp Privs [temp_privs]

User avatar
ChimneySwift
Member
 
Posts: 319
Joined: Fri Sep 22, 2017 06:46
Location: 127.0.0.1
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift

[Mod] Temp Privs [temp_privs]

by ChimneySwift » Sun Dec 24, 2017 04:51

Temp Privs

Overwrites the default grant, grantme and revoke chatcommands to add revoke or grant expiration.

GitHub
ZIP Download

Code license: MIT

Dependencies: None

Usage

The default commands still work for permanant grants and revokes, however you can optionally select a time period whereby the revoke/granting will be reverted.

grant <playername> <time-optional> <privstring>
grantme <time-optional> <privstring>
revoke <playername> <time-optional> <privstring>

<time> syntax:

  • 1s - one second.
  • 1m - one minute.
  • 1h - one hour.
  • 1D - one day (24 hours).
  • 1W - one week (7 days).
  • 1M - one month (30 days).
  • 1Y - one year (360 days).
A spoon is basically a tiny bowl with a stick on it
 

User avatar
KatzEyez
Member
 
Posts: 29
Joined: Tue Aug 08, 2017 18:24
Location: (IG: Depends) (RL: USA)
GitHub: LadyK
IRC: LadyK
In-game: LadyK

Re: [Mod] Temp Privs [temp_privs]

by KatzEyez » Sun Dec 24, 2017 12:20

I like this one, because there have been times where I forgot to revoke spill on a player after granting it to them temporarily. I could just say "/grant <player> 1h spill" and not have to worry about making sure I remember to revoke it later on.
I can see it working well the other way too. If two players are arguing with one another, instead of banning them, you would give them a time out by suspending their privs temporarily perhaps. "/revoke <player> 10m shout". Once they're allowed to talk again, if the situation continues or escalates, then you can move forward with other punishments as you normally would. This strengthens warnings as well as allows mods/admins to take control of a situation in a different way.
I don't understand the coding, so I'm curious if this will also tell the player that this isn't a permanent action and how long it will last?
Hiya everyone! ^_^ LadyK is officially back! Got Discord? I'm LadyK#3914 if you want to add me.
 

User avatar
Lone_Wolf
Member
 
Posts: 1984
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf
 

User avatar
ChimneySwift
Member
 
Posts: 319
Joined: Fri Sep 22, 2017 06:46
Location: 127.0.0.1
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift

Re: [Mod] Temp Privs [temp_privs]

by ChimneySwift » Mon Dec 25, 2017 02:25

KatzEyez wrote:I don't understand the coding, so I'm curious if this will also tell the player that this isn't a permanent action and how long it will last?


It modifies the granting/revoking messages so on the end it will add how long the grant/revoke was for.

For example:
  • ChimneySwift granted you privileges: kick for: 1h
  • ChimneySwift revoked privileges from you: kick for: 1h
  • ChimneySwift granted you privileges: fly for: indefinitely

That string also shows up in the logs and in the message sent to the kicker/revoker.

If the player is online at the time their temporary grant/revoke expires, they will be sent a message like this:
  • Revoked privileges from you: fast (expired)
A spoon is basically a tiny bowl with a stick on it
 

User avatar
ThomasMonroe
Member
 
Posts: 278
Joined: Tue Apr 04, 2017 16:21
Location: Wherever I am at
GitHub: ThomasMonroe314
IRC: ThomasMonroe TMcSquared
In-game: ThomasMonroe TMcSquared

Re: [Mod] Temp Privs [temp_privs]

by ThomasMonroe » Mon Dec 25, 2017 12:33

This will come in handy for Legends Of Survival! :)
Projects|:*sigh* school: :Qub³d: :Legends Of Survival: :making people think:
I don't make things messy, I just *cough* disturb the local entropy.
 

User avatar
ChimneySwift
Member
 
Posts: 319
Joined: Fri Sep 22, 2017 06:46
Location: 127.0.0.1
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift

Re: [Mod] Temp Privs [temp_privs]

by ChimneySwift » Wed Dec 27, 2017 05:19

Fixed an issue where /revoke <playername> <time-optional> all didn't work.

Also resolved a bug where revoking a privilege the user didn't have for an amount of time would cause that privilege to be granted to them after the time ran out.
A spoon is basically a tiny bowl with a stick on it
 

User avatar
ManElevation
Member
 
Posts: 895
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
 

User avatar
Linuxdirk
Member
 
Posts: 1672
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk
 

User avatar
ChimneySwift
Member
 
Posts: 319
Joined: Fri Sep 22, 2017 06:46
Location: 127.0.0.1
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift

Re: [Mod] Temp Privs [temp_privs]

by ChimneySwift » Thu Dec 28, 2017 00:33

Linuxdirk wrote:
ChimneySwift wrote:Overwrites the default […]

Don’t do that.


I'm sorry but you didn't exactly elaborate to tell me exactly what not to do or why not to do it.

The default commands still work exactly the same as they do in default Minetest, and much of the code which handles the revoking and granting of privileges is derived from default Minetest.
A spoon is basically a tiny bowl with a stick on it
 

ShadMOrdre
Member
 
Posts: 135
Joined: Mon Dec 29, 2014 08:07
Location: USA
In-game: shadmordre

Re: [Mod] Temp Privs [temp_privs]

by ShadMOrdre » Fri Dec 29, 2017 04:49

When granting a user multiple privs in one shot, ie, /grant UserName fast, fly, home, this mod fails. It attempts to grant fly and home privs for "fast" length of time.

Since the time param is optional, this will always fail. So my recommendation is that you use some identifier to specify indefinite, instead of relying on the absense of the time param. And yes, since you override builtin for this, you might want to make sure that privs checks are done, and enforced, on the user granting said privs. You might want to consider figuring out a way to add to builtin instead of override, or as suggested above, send a PR to have this added to builtin.

EDIT: On second thought, maybe just a different chatcommand, say, /grant_temp, so that you don't have to override builtin. This should be considered if PR to add this to builtin is denied.

I like this concept alot, so thanks for making this mod. Please consider above comments.

Shad
My other virtual world is an Opensimulator.
 

User avatar
ChimneySwift
Member
 
Posts: 319
Joined: Fri Sep 22, 2017 06:46
Location: 127.0.0.1
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift

Re: [Mod] Temp Privs [temp_privs]

by ChimneySwift » Fri Dec 29, 2017 08:24

ShadMOrdre wrote:When granting a user multiple privs in one shot, ie, /grant UserName fast, fly, home, this mod fails. It attempts to grant fly and home privs for "fast" length of time.

Since the time param is optional, this will always fail. So my recommendation is that you use some identifier to specify indefinite, instead of relying on the absense of the time param. And yes, since you override builtin for this, you might want to make sure that privs checks are done, and enforced, on the user granting said privs. You might want to consider figuring out a way to add to builtin instead of override, or as suggested above, send a PR to have this added to builtin.


Sounds like a definite issue, have you tried entering the priv string without spaces? I'm pretty sure I tested with multiples but I never used spaces.

I will definitely investigate, if this works with the default commands it should work with this mod too.

ShadMOrdre wrote:EDIT: On second thought, maybe just a different chatcommand, say, /grant_temp, so that you don't have to override builtin. This should be considered if PR to add this to builtin is denied.


I don't personally like having multiple commands for this, but I guess if I can't get it to work exactly like default with or without the time I'll have to consider it.

Above all thank you for submitting this issue.
A spoon is basically a tiny bowl with a stick on it
 

User avatar
Linuxdirk
Member
 
Posts: 1672
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Temp Privs [temp_privs]

by Linuxdirk » Fri Dec 29, 2017 11:24

ChimneySwift wrote:The default commands still work exactly the same as they do in default Minetest, …

Obviously they don’t. This is one of the reasons not to override defaults.
 

User avatar
ChimneySwift
Member
 
Posts: 319
Joined: Fri Sep 22, 2017 06:46
Location: 127.0.0.1
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift

Re: [Mod] Temp Privs [temp_privs]

by ChimneySwift » Sat Dec 30, 2017 04:07

Linuxdirk wrote:
ChimneySwift wrote:The default commands still work exactly the same as they do in default Minetest, …

Obviously they don’t. This is one of the reasons not to override defaults.


Yes, that's obviously a bug, this is still a WIP mod and thus not guaranteed to work as advertised, the "final" version won't have this issue.
A spoon is basically a tiny bowl with a stick on it
 

User avatar
ChimneySwift
Member
 
Posts: 319
Joined: Fri Sep 22, 2017 06:46
Location: 127.0.0.1
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift

Re: [Mod] Temp Privs [temp_privs]

by ChimneySwift » Sun Feb 25, 2018 22:47

ShadMOrdre wrote:When granting a user multiple privs in one shot, ie, /grant UserName fast, fly, home, this mod fails. It attempts to grant fly and home privs for "fast" length of time.

This issue is now resolved.

If the time value cannot be converted to seconds via the parse_time() function, it will act as though the time value is part of the priv string.
A spoon is basically a tiny bowl with a stick on it
 


Return to WIP Mods



Who is online

Users browsing this forum: Google [Bot], SteveGer and 3 guests