Jump to content
McKay Development

group user permissions


Naleksuh

Recommended Posts

How can I check if a user has a permissions? There doesn't seem to be any method for it at all. I can't even find out whether or not a user has a role or what that role would do.

 

Specifically, I want to make a command only do something if a user has the "Add and Delete Channels" permissions

Link to comment
Share on other sites

I've not verified whether this works, but reading over the docs it seems like this would be the way you'd check if a user has a given permission:

  1. Call setSessionActiveGroups on startup to get Chat Room Group State
  2. Record the Chat Room Member data from Chat Room Group State. This data includes member role IDs.
  3. Record the Chat Room Group Header State data from Chat Room Group State. This data includes Chat Role Actions.
  4. When you want to see if a member has the permission you want to check, look them up in the Chat Room Member list from Chat Room Group State, and see in Chat Role Actions if the roles that map to their role IDs include the permission you want to check.
Link to comment
Share on other sites

This does seem that it will technically work, but rather complex and inconsistent (i.e. data being changed after startup). I'd prefer if there was a direct method, i.e client.chat.userHasPermission(steamid64, chat_id, permission_string) , but I guess this is fine too. Could you consider adding it in a future version, though?

Link to comment
Share on other sites

The only issue should be if you get a new moderator or if you change roles, although I grant that it would be ideal to not have those be issues at all.

Eventually I'm sure I'll add some events to alert you when a new member joins, when a member's roles are updated, and when role permissions are updated. I'm not sure I'll ever end up adding a method like you suggest though, since that would require steam-user to keep knowledge of chat rooms' states (it doesn't currently), although I can see how that would be useful.

Link to comment
Share on other sites

Quote

The only issue should be if you get a new moderator or if you change roles

This is a public bot used intended for use in chat i don't moderate. Can't really act like that won't happen.

 

Quote

I'm not sure I'll ever end up adding a method like you suggest though, since that would require steam-user to keep knowledge of chat rooms' states (it doesn't currently), although I can see how that would be useful.

Is there a problem with only tracking them when the needed method is called?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...