• Print

Author Topic: Get group inherited?  (Read 4907 times)

0 Members and 1 Guest are viewing this topic.

Offline JasonMan

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Get group inherited?
« on: February 23, 2016, 12:57:48 am »
Is there a way to get the group which group X inherits from, without reading groups.txt and some ugly sorting?
So for example (From groups.txt):
Code: [Select]
"admin"
{
"can_target"    "!%admin"
    "allow"
    {
    --Commands &
    }
    "inherit_from"  "moderator"
}

I want to get "moderator" from "admin"
« Last Edit: February 23, 2016, 01:00:29 am by JasonMan »

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Get group inherited?
« Reply #1 on: February 23, 2016, 01:12:55 am »
All information about groups is stored in ULib.ucl.groups.

Code: Lua
  1. print(ULib.ucl.groups["admin"].inherit_from)

Offline JasonMan

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Re: Get group inherited?
« Reply #2 on: February 23, 2016, 01:15:51 am »
All information about groups is stored in ULib.ucl.groups.

Code: Lua
  1. print(ULib.ucl.groups["admin"].inherit_from)

Thanks!
Is there no documentation of this? I know about the ulib documentation but nowhere did it say what you just told me...

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Get group inherited?
« Reply #3 on: February 23, 2016, 01:38:21 am »
Thanks!
Is there no documentation of this? I know about the ulib documentation but nowhere did it say what you just told me...

The docs say ULib.ucl holds all things related to ULib's access control.

https://ulyssesmod.net/docs/files/lua/ulib/shared/sh_ucl-lua.html#Tables

More details can be found in the source code that relates to that doc:

https://github.com/TeamUlysses/ulib/blob/7170aceb0a9372086e56606c35095372c4391791/lua/ulib/shared/sh_ucl.lua#L16
« Last Edit: July 11, 2018, 12:15:38 am by Timmy »

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Get group inherited?
« Reply #4 on: February 23, 2016, 08:14:36 am »
Additionally, if it's helpful, you can get a nested table of inheritance:
http://ulyssesmod.net/docs/files/lua/ulib/shared/sh_ucl-lua.html#ucl.getInheritanceTree
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

  • Print