Enforce subscriptio permission to data track (#4588)
* Enforce subscriptio permission to data track * use revoke path as same as media track * nil check
This commit is contained in:
@@ -705,6 +705,9 @@ func (r *Room) onUpdateSubscriptionPermission(participant types.LocalParticipant
|
||||
for _, track := range participant.GetPublishedTracks() {
|
||||
r.trackManager.NotifyTrackChanged(track.ID())
|
||||
}
|
||||
for _, track := range participant.GetPublishedDataTracks() {
|
||||
r.trackManager.NotifyTrackChanged(track.ID())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -746,6 +749,13 @@ func (r *Room) ResolveDataTrackForSubscriber(sub types.LocalParticipant, trackID
|
||||
res.TrackRemovedNotifier = r.trackManager.GetOrCreateTrackRemoveNotifier(trackID)
|
||||
res.PublisherIdentity = info.PublisherIdentity
|
||||
res.PublisherID = info.PublisherID
|
||||
|
||||
pub := r.GetParticipantByID(info.PublisherID)
|
||||
// when publisher is not found, we will assume it doesn't have permission to access
|
||||
if pub != nil {
|
||||
res.HasPermission = IsParticipantExemptFromTrackPermissionsRestrictions(sub) || pub.HasPermission(trackID, sub.Identity())
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user