Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server-initiated unpublish & permissions #107

Merged
merged 2 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion auth/grants.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package auth

import (
"github.com/livekit/protocol/livekit"
)

type VideoGrant struct {
// actions on rooms
RoomCreate bool `json:"roomCreate,omitempty"`
Expand All @@ -18,7 +22,8 @@ type VideoGrant struct {
CanPublishData *bool `json:"canPublishData,omitempty"`

// participant is not visible to other participants
Hidden bool `json:"hidden,omitempty"`
Hidden bool `json:"hidden,omitempty"`
// indicates to the room that current participant is a recorder
Recorder bool `json:"recorder,omitempty"`
}

Expand All @@ -42,3 +47,34 @@ func (v *VideoGrant) SetCanPublishData(val bool) {
func (v *VideoGrant) SetCanSubscribe(val bool) {
v.CanSubscribe = &val
}

func (v *VideoGrant) GetCanPublish() bool {
if v.CanPublish == nil {
return true
}
return *v.CanPublish
}

func (v *VideoGrant) GetCanPublishData() bool {
if v.CanPublishData == nil {
return v.GetCanPublish()
}
return *v.CanPublishData
}

func (v *VideoGrant) GetCanSubscribe() bool {
if v.CanSubscribe == nil {
return true
}
return *v.CanSubscribe
}

func (v *VideoGrant) ToPermission() *livekit.ParticipantPermission {
return &livekit.ParticipantPermission{
CanPublish: v.GetCanPublish(),
CanPublishData: v.GetCanPublishData(),
CanSubscribe: v.GetCanSubscribe(),
Hidden: v.Hidden,
Recorder: v.Recorder,
}
}
187 changes: 81 additions & 106 deletions livekit/livekit_internal.pb.go

Large diffs are not rendered by default.

Loading