• Print

Author Topic: An idea for an IsRoot check in ULX.  (Read 5840 times)

0 Members and 1 Guest are viewing this topic.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
An idea for an IsRoot check in ULX.
« on: December 26, 2013, 01:35:22 pm »
I was thinking what if Garrysmod had another check to see if a person is above superadmin, and I came up with this...

Code: Lua
  1. local meta = FindMetaTable("Player")
  2.  
  3. --[[---------------------------------------------------------
  4.         Stuff For Administration Under Root
  5. -----------------------------------------------------------]]
  6.  
  7. local oldf_IsSuperAdmin = meta:IsSuperAdmin
  8.  
  9. function meta:IsSuperAdmin()
  10.         if self:GetPData("IsRoot") then
  11.                 return true
  12.         end
  13.         ------
  14.         oldf._IsSuperAdmin()
  15. end
  16.  
  17. function meta:IsRoot()
  18.  
  19.         -- Admin SteamID need to be fully authenticated by Steam!
  20.         if ( self.IsFullyAuthenticated && !self:IsFullyAuthenticated() ) then return false end
  21.        
  22.         if self:GetPData("IsRoot") then
  23.                 if !self:IsUserGroup("owner") then ulx.adduser( nil, self, "owner" ) end -- Need to figure out how to find the highest rank
  24.                 -- The above makes it so that we can not be demoted. (Conventionally at least.)
  25.                 return true
  26.         end
  27.        
  28.        
  29.         -- Below we need a way to check if the group is above superadmin.
  30.        
  31.         -- I have no idea how to do this...
  32.        
  33.         -- The PData will also be set here.
  34.        
  35. end
  36.  
  Also on pastebin http://pastebin.com/wYQ0YpC3

Now its obviously not done and obviously untested but I would like to hear some thoughts and opinions on this. ( Although I do have a this sinking feeling... )
I cry every time I see that I am not a respected member of this community.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: An idea for an IsRoot check in ULX.
« Reply #1 on: December 26, 2013, 07:42:33 pm »
How is this different from creating another group in ULib?
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: An idea for an IsRoot check in ULX.
« Reply #2 on: December 26, 2013, 07:53:39 pm »
Code: [Select]
IsRoot( var ) = IsSuperAdmin( var )There, done.
Superadmin is root in gmod. How many countless hours do we have to spend troubleshooting the same issue over and over, telling people who's scripts aren't working right because they tried to create a group higher than superadmin and now some other script isn't working, including but not limited to ULX not working.

As far as I'm concerned, I'd love to lock every single thread that mentions/starts off "I created group owner and had it inherit superadmin and .... "

Seriously. Ulib allows for custom groups.
By NO means should it be used to circumvent Gmod standard 'root' level access of superadmin.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: An idea for an IsRoot check in ULX.
« Reply #3 on: December 26, 2013, 09:55:00 pm »
Code: [Select]
IsRoot( var ) = IsSuperAdmin( var )There, done.
Superadmin is root in gmod. How many countless hours do we have to spend troubleshooting the same issue over and over, telling people who's scripts aren't working right because they tried to create a group higher than superadmin and now some other script isn't working, including but not limited to ULX not working.

As far as I'm concerned, I'd love to lock every single thread that mentions/starts off "I created group owner and had it inherit superadmin and .... "

Seriously. Ulib allows for custom groups.
By NO means should it be used to circumvent Gmod standard 'root' level access of superadmin.

I see you skimmed through my post and did not really read it...
I cry every time I see that I am not a respected member of this community.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: An idea for an IsRoot check in ULX.
« Reply #4 on: December 26, 2013, 10:00:03 pm »
How is this different from creating another group in ULib?

This should restore your rank if you ever get demoted by accident or some thing like that, I also think it would be a good idea to lock the privileges for adding and removing groups into the IsRoot check that way it makes it so you never lose your owner ship rank and so that you can not accidently remove the ability to give permissions from your self. Also this should check PData as well as if you inherit from superadmin that way it will always know who is the owner of the server even if they are demoted or if some thing bad happens to their rank. (Pretty much a fool proofing to avoid situations like...  /index.php/topic,6852.0.html)

Also it really is just a concept that popped into my head, and was some thing I wanted to share... so no need to hate on me I know about... /index.php/topic,6291.0.html
« Last Edit: December 26, 2013, 10:01:43 pm by HeLLFox_15 »
I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: An idea for an IsRoot check in ULX.
« Reply #5 on: December 27, 2013, 02:08:40 pm »
Any server "owner" will have access to a server console or control panel with access to the console.
Console will always have direct access to all commands. If they removed a command, it's their own darn fault and they can either reset ulx or modify the groups file on the server manually to get it back.

Not hating.
Just don't see the need.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Re: An idea for an IsRoot check in ULX.
« Reply #6 on: December 30, 2013, 11:59:06 am »
If you go into garrysmod/settings/users.txt

then you will find something that is really amazing.

...

Write your name and steam ID as the example of Garry himself and tadaaa you can not be demoted, if you get demoted reconnect and youre superadmin again... ajhgfkdhlfhjndbguifgnhbkjhfdlkghdklfghskldghkljhfgdklöfg




Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: An idea for an IsRoot check in ULX.
« Reply #7 on: December 31, 2013, 01:52:28 am »
If you go into garrysmod/settings/users.txt

Write your name and steam ID as the example of Garry himself and tadaaa you can not be demoted, if you get demoted reconnect and youre superadmin again...

Thank you so much for reminding me :D
I cry every time I see that I am not a respected member of this community.

  • Print