Facepunch / sbox-issues

178 stars 12 forks source link

Usergroups #3726

Closed Longboyy closed 12 months ago

Longboyy commented 1 year ago

For?

S&Box

What can't you do?

Currently other than explicitly adding an admin lib such as breaker, there is no way to check if a user is an admin. The solution to this already exists in Garry's Mods: Usergroups.

How would you like it to work?

Similarly to Garry's Mod, I'd expect that I would be able to access/set a clients usergroup, although with the addition of support for multiple user groups.

IClient.GetUserGroups() : string[] IClient.AddUserGroup(string userGroup) : void IClient.HasUserGroup(string userGroup) : bool IClient.RemoveUserGroup(string userGroup) : void IClient.SetUserGroups(string[] userGroups) : void

What have you tried?

N/A

Additional context

No response

LeQuackers commented 1 year ago

Instead of methods, I'd opt for an ISet<string> property that gets networked or just using tags.

Weldify commented 1 year ago

Looks like usergroups are just meant to be tags, so why not use tags instead

Longboyy commented 1 year ago

Looks like usergroups are just meant to be tags, so why not use tags instead

In your mind, what do you see that looking like as a tag? Something like usergroups:group1,group2? Whilst this does technically work, it's non-standard and as such makes it harder for code to be admin addon/lib agnostic. Although, I don't see why this couldn't use tags behind the scenes, whilst still having dedicated methods/property.

Weldify commented 1 year ago

Just add an "admin" tag for admins and a "moderator" tag for moderators, it doesn't need any special treatment

LeQuackers commented 1 year ago

mildly related: #3758