Ulysses Stuff > Suggestions

Temporary user group change

<< < (3/4) > >>

Megiddo:
I could look into passing parameters thru UCLChanged to specify what's changing. I don't remember if I didn't do this originally out of laziness or some technical reason. :P

JamminR:
Meg, if there's not a technical reason, I could see this being helpful.
Perhaps a 'diff' table combined with a 'whodunnit'
whodunnit;whogotit;whatitwas;whatitnowis
That's extremely simplified of course, but ya get what i mean.

MrPresident:

--- Quote from: Stickly Man! on July 02, 2011, 08:48:23 AM ---I'm all for making sure that temp group "demotions" are executed exactly when they need to be-- If I temporarily promote "bob" to superadmin for a day, but then he never joins the server again, weeks later he will show up in the "superadmin" group even though he's really not in that group anymore.

--- End quote ---
Well, he wouldn't. The way it would work is that the script would query against the database when the player authenticates and then would set the group accordingly. I suppose that for a split second he would be considered to be in the temp group but this wouldn't be noticeable to either the client or the server.

I do like the idea of checking for new groups of people every 3 hours or so and creating timers accordingly. This seems to be an efficient way of doing it without creating timers for everyone who is in a temp group.

My only thing at this point is still how to detect if someone has had their group changed with standard ULib.ucl.addUser or ULib.ucl.removeUser. I suppose that I could modify the original code for now until (if possible) Megiddo can write the appropriate info into the hook.

Question: If I modify the adduser and removeuser functions in a module that I create as an addon, will that overwrite the original functions or will they conflict?

JamminR:

--- Quote from: MrPresident on July 02, 2011, 01:08:47 PM ---Question: If I modify the adduser and removeuser functions in a module that I create as an addon, will that overwrite the original functions or will they conflict?

--- End quote ---

It's my understanding that if a a function is local, they run in conjunction (not directly conflict) with the others.
(with possibility to conflict if using global vars of course)
Meg/Stick, back me up/correct me on this?
It's a quick easy test anyway... write;

--- Code: ---local function ulx.adduser(I,forget,real,vars)
--print to console "this worked"
end
local adduser = <standard ULX command object and parms>
adduser:<standard ULX command object and parms>
adduser:<standard ULX command object and parms>

--- End code ---
run the server. addyourself to another group, see if you get added and that the object ran.

Why overwrite though?
If you're going to use exact same command names, use PostTranslatedCommand or CommandCalled (if needed pre)

Stick brings up a good point previously though. If someone else writes a command that modifies ULib.ucl.<groups||users>, your add/removeuser overwrite won't see it.
Might as well write custom checks into a long drawn out UCLChanged hook function (which, Megiddo is probably willing to 'update' to contain more, with some consideration of what might break of course)

Stickly Man!:

--- Quote from: MrPresident on July 02, 2011, 01:08:47 PM ---Well, he wouldn't. The way it would work is that the script would query against the database when the player authenticates and then would set the group accordingly. I suppose that for a split second he would be considered to be in the temp group but this wouldn't be noticeable to either the client or the server.

--- End quote ---

I think I'm still a bit confused on how you're planning on having this work lol-- I'm under the impression that when someone is temporarily promoted into any given group, they're immediately adduser'd to that group, then their record of promotion is stored in your database. Then whenever that player joins, their record is checked to see if they've expired or not? If that's how it's set up, then it was as I was saying earlier, if "bob" never joins for weeks, admins will always see "bob" in the list of superadmins (XGUI) even though it's past expiration.



--- Quote from: MrPresident on July 02, 2011, 01:08:47 PM ---Question: If I modify the adduser and removeuser functions in a module that I create as an addon, will that overwrite the original functions or will they conflict?

--- End quote ---

Just "hijack" the function-- I do it in XGUI a couple of times, especially with ban functions. It works like this:

--- Code: ---local tempfunc = ULib.ucl.adduser
ULib.ucl.adduser = function( id, allows, denies, group )
   tempfunc( id, allows, denies, group ) --Call the original adduser function
   --Add your code here
end

--- End code ---

Thus, the function remains unmodified, and your code gets executed. Obviously, if some mod were to overwrite the adduser function entirely, and it's overwritten AFTER you hijack the function, then you would have issues. Having more information with UCLChanged would also work nicely :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version