apply fix on Webinars Provider ...
This commit is contained in:
@@ -522,11 +522,9 @@ namespace xWebinarService.Providers
|
||||
/// Remove Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RemoveWebinar(
|
||||
Guid webinarId,
|
||||
string requesterUserSelectByParam = null
|
||||
Guid webinarId
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -551,27 +549,17 @@ namespace xWebinarService.Providers
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Permissions ...
|
||||
result = entity.OwnerId == requesterUserSelectByParam;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Remove ...
|
||||
var subscribers = await GetSubscribers(
|
||||
webinarId: webinarId,
|
||||
requesterUserSelectByParam: requesterUserSelectByParam
|
||||
webinarId: webinarId
|
||||
);
|
||||
try
|
||||
{
|
||||
//
|
||||
await subscribers.SelectAsync(async s => await Unsubscribe(
|
||||
webinarId: webinarId,
|
||||
subscriberId: s.SubscriberId,
|
||||
requesterUserSelectByParam: requesterUserSelectByParam
|
||||
subscriberId: s.SubscriberId
|
||||
));
|
||||
|
||||
//
|
||||
@@ -600,12 +588,10 @@ namespace xWebinarService.Providers
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> Subscribe(
|
||||
Guid webinarId,
|
||||
string subscriberId,
|
||||
string requesterUserSelectByParam = null
|
||||
string subscriberId
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -636,19 +622,7 @@ namespace xWebinarService.Providers
|
||||
|
||||
//
|
||||
// Check Webinar Enabled ...
|
||||
result =
|
||||
webinar.Enabled ||
|
||||
requesterUserSelectByParam == webinar.OwnerId;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Webinar Type ...
|
||||
result =
|
||||
webinar.Type == XWebinarType.Public ||
|
||||
requesterUserSelectByParam == webinar.OwnerId;
|
||||
result = webinar.Enabled;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
@@ -755,12 +729,10 @@ namespace xWebinarService.Providers
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> Unsubscribe(
|
||||
Guid webinarId,
|
||||
string subscriberId,
|
||||
string requesterUserSelectByParam = null
|
||||
string subscriberId
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -792,16 +764,6 @@ namespace xWebinarService.Providers
|
||||
// Retrieve Webinar ...
|
||||
var webinar = await WebinarRepository.GetAsync(webinarId);
|
||||
|
||||
//
|
||||
// Check Permission ...
|
||||
result =
|
||||
requesterUserSelectByParam == subscriberId ||
|
||||
requesterUserSelectByParam == webinar.OwnerId;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Subscription Entity ...
|
||||
var entity = await WebinarSubscriberRepository.FindOneAsync(ws =>
|
||||
@@ -820,12 +782,10 @@ namespace xWebinarService.Providers
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XWebinarSubscriberDto> GetSubscriber(
|
||||
Guid webinarId,
|
||||
string subscriberId,
|
||||
string requesterUserSelectByParam = null
|
||||
string subscriberId
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -860,16 +820,6 @@ namespace xWebinarService.Providers
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Check Permissions ...
|
||||
isValid =
|
||||
subscriberId == requesterUserSelectByParam ||
|
||||
webinar.OwnerId == requesterUserSelectByParam;
|
||||
if (!isValid)
|
||||
{
|
||||
XException.NotAllowed.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Converts to Subscriber Dto ...
|
||||
var result = await ToXWebinarSubscriberDto(entity);
|
||||
@@ -880,11 +830,9 @@ namespace xWebinarService.Providers
|
||||
/// Get all Specified Webinars Subscribers ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<XWebinarSubscriberDto>> GetSubscribers(
|
||||
Guid webinarId,
|
||||
string requesterUserSelectByParam = null
|
||||
Guid webinarId
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -906,15 +854,6 @@ namespace xWebinarService.Providers
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Check Permissions ...
|
||||
isValid =
|
||||
webinar.OwnerId == requesterUserSelectByParam;
|
||||
if (!isValid)
|
||||
{
|
||||
XException.NotAllowed.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
var subscribers = await WebinarSubscriberRepository.FindManyAsync(e =>
|
||||
e.WebinarId == webinarId
|
||||
@@ -934,12 +873,10 @@ namespace xWebinarService.Providers
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XQueryResult<XWebinarSubscriberDto>> QuerySubscribers(
|
||||
Guid webinarId,
|
||||
XQuery query,
|
||||
string requesterUserSelectByParam = null
|
||||
XQuery query
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -968,8 +905,7 @@ namespace xWebinarService.Providers
|
||||
//
|
||||
// Retrieve all Items ...
|
||||
var items = await GetSubscribers(
|
||||
webinarId: webinarId,
|
||||
requesterUserSelectByParam: requesterUserSelectByParam
|
||||
webinarId: webinarId
|
||||
);
|
||||
var totalItemsCount = items.Count();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user