func HasPermissionToChannel(user *model.User, teamMember *model.TeamMember, channelMember *model.ChannelMember, permission *model.Permission) bool { if channelMember == nil { return false } roles := channelMember.GetRoles() if CheckIfRolesGrantPermission(roles, permission.Id) { return true } return HasPermissionToTeam(user, teamMember, permission) }