Role Definition

Dear all, first o fall many thanks for this projects it’s really great.
I have a quick question, I’m building a web application for a school interested in OpenVidu and I need to distinguish the user who creates de room vs the other participants who join later on. This definition would help me to perform some special actions like mute all mics / open all mics except the main publisher one…

I checked the REST /api/sessions and I found a “role”:“PUBLISHER” attribute in the json.

Can you please let me know if does exist more values like Moderator, Guest,…?
I’m not sure if this is the right approach in case any suggestion is really appreciated.

Many Thanks. J.

Hi,

You have a complete definition of available roles here: https://docs.openvidu.io/en/2.14.0/api/openvidu-node-client/enums/openvidurole.html

It is very similar to TokBox roles management: https://tokbox.com/developer/guides/create-token/

These 3 roles allow for basic configuration of what each user will be able to do with respect to the media: only receive; receive and send; receive and send and manage other user’s media. But you can then of course implement your own logic to make clients perform whatever action you want whenever you want. The only thing is that technically those actions won’t be “hacker-proof”: there’s no specifc role for “opening and closing mics of certain participants”, so you can implement that with your own logic (probably Session.signal would be very useful here. There’s also a server-side version) but that action could be technically “hacked” from the browser side, as there is no check for it on OpenVidu Server. That being said, that’s not usually a big concern, as most important actions (subscribe, publish and manage media) are covered by existing roles. You can check at any moment what actions a client can perform with Session.capabilities object.

Regards

Very Useful I’ll give a try and let you know.

Muchas Gracias! J

I’m interested to read up on these roles, but many of the mentioned links now 404. I’ve been searching like mad to find resources on these roles and can’t find them. If anyone has some current links, I’d really appreciate it.

Can you share with us what links are broken?

Let me edit all the links above pointing to the old documentation site. We migrated all our docs to a site that allows versioning and some links may be broken now.