feat: unpublish tracks after publish permissions are revoked. (#545)
* feat: unpublish tracks after publish permissions are revoked. Uses protocol 7 to indicate client support, otherwise it attempts to mute the tracks. Also sends back permissions objects of all participants, and cleaned up our handling of various permissions attributes. * fix static check
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/livekit/protocol/auth"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/utils"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/config"
|
||||
@@ -344,16 +345,23 @@ func newParticipantForTestWithOpts(identity livekit.ParticipantIdentity, opts *p
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
grants := &auth.ClaimGrants{
|
||||
Video: &auth.VideoGrant{},
|
||||
}
|
||||
if opts.permissions != nil {
|
||||
grants.Video.SetCanPublish(opts.permissions.CanPublish)
|
||||
grants.Video.SetCanPublishData(opts.permissions.CanPublishData)
|
||||
grants.Video.SetCanSubscribe(opts.permissions.CanSubscribe)
|
||||
}
|
||||
p, _ := NewParticipant(ParticipantParams{
|
||||
SID: livekit.ParticipantID(utils.NewGuid(utils.ParticipantPrefix)),
|
||||
Identity: identity,
|
||||
Config: rtcConf,
|
||||
Sink: &routingfakes.FakeMessageSink{},
|
||||
ProtocolVersion: opts.protocolVersion,
|
||||
PLIThrottleConfig: conf.RTC.PLIThrottle,
|
||||
Grants: &auth.ClaimGrants{
|
||||
Video: &auth.VideoGrant{},
|
||||
},
|
||||
}, opts.permissions)
|
||||
Grants: grants,
|
||||
})
|
||||
return p
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user