last ...
This commit is contained in:
@@ -57,13 +57,6 @@ namespace xWebinarService.Controllers
|
|||||||
/// <param name="tags"></param>
|
/// <param name="tags"></param>
|
||||||
/// <param name="files"></param>
|
/// <param name="files"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
|
||||||
/// Create Webinar ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item"></param>
|
|
||||||
/// <param name="tags"></param>
|
|
||||||
/// <param name="files"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("")]
|
[HttpPost("")]
|
||||||
public virtual async Task<ActionResult<XWebinarDto>> CreateWebinar(
|
public virtual async Task<ActionResult<XWebinarDto>> CreateWebinar(
|
||||||
[FromForm] XWebinarDto item,
|
[FromForm] XWebinarDto item,
|
||||||
|
|||||||
@@ -89,12 +89,6 @@ namespace xWebinarService.Interfaces
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XWebinarDto> GetWebinar(Guid id);
|
Task<XWebinarDto> GetWebinar(Guid id);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieve all Exists Webinar Ids ...
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
IEnumerable<Guid> GetWebinarIds();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve all Exists Webinars ...
|
/// Retrieve all Exists Webinars ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -139,13 +133,6 @@ namespace xWebinarService.Interfaces
|
|||||||
XUserClaimsInfoDto userInfo = null
|
XUserClaimsInfoDto userInfo = null
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Query Webinar Ids ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="query"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
XQueryResult<Guid> QueryWebinarIds(XQuery query);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove Specified Webinar ...
|
/// Remove Specified Webinar ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -168,11 +155,13 @@ namespace xWebinarService.Interfaces
|
|||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
/// <param name="subscriberId"></param>
|
/// <param name="subscriberId"></param>
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> Subscribe(
|
Task<bool> Subscribe(
|
||||||
Guid webinarId,
|
Guid webinarId,
|
||||||
string subscriberId,
|
string subscriberId,
|
||||||
string connectionId = null
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -180,10 +169,12 @@ namespace xWebinarService.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
/// <param name="subscriberId"></param>
|
/// <param name="subscriberId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> IsSubscribed(
|
Task<bool> IsSubscribed(
|
||||||
Guid webinarId,
|
Guid webinarId,
|
||||||
string subscriberId
|
string subscriberId,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -192,11 +183,13 @@ namespace xWebinarService.Interfaces
|
|||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
/// <param name="subscriberId"></param>
|
/// <param name="subscriberId"></param>
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> Unsubscribe(
|
Task<bool> Unsubscribe(
|
||||||
Guid webinarId,
|
Guid webinarId,
|
||||||
string subscriberId,
|
string subscriberId,
|
||||||
string connectionId = null
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -204,28 +197,36 @@ namespace xWebinarService.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
/// <param name="subscriberId"></param>
|
/// <param name="subscriberId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XWebinarSubscriberDto> GetSubscriber(
|
Task<XWebinarSubscriberDto> GetSubscriber(
|
||||||
Guid webinarId,
|
Guid webinarId,
|
||||||
string subscriberId
|
string subscriberId,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all Specified Webinars Subscribers ...
|
/// Get all Specified Webinars Subscribers ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XWebinarSubscriberDto>> GetSubscribers(Guid webinarId);
|
Task<IEnumerable<XWebinarSubscriberDto>> GetSubscribers(
|
||||||
|
Guid webinarId,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Query Specified Webinar's Subscribers ...
|
/// Query Specified Webinar's Subscribers ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
/// <param name="query"></param>
|
/// <param name="query"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XQueryResult<XWebinarSubscriberDto>> QuerySubscribers(
|
Task<XQueryResult<XWebinarSubscriberDto>> QuerySubscribers(
|
||||||
Guid webinarId,
|
Guid webinarId,
|
||||||
XQuery query
|
XQuery query,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
);
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -265,8 +266,12 @@ namespace xWebinarService.Interfaces
|
|||||||
/// Get Webinar Files ...
|
/// Get Webinar Files ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XFileDto>> GetFiles(Guid id);
|
Task<IEnumerable<XFileDto>> GetFiles(
|
||||||
|
Guid id,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stream Specified File ...
|
/// Stream Specified File ...
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ namespace xWebinarService.Providers
|
|||||||
public class XWebinarFileProvider : XBaseFileProvider<Guid>, IXWebinarFileProvider
|
public class XWebinarFileProvider : XBaseFileProvider<Guid>, IXWebinarFileProvider
|
||||||
{
|
{
|
||||||
public XWebinarFileProvider(
|
public XWebinarFileProvider(
|
||||||
IXFileProvider provider
|
IXFileProvider fileProvider
|
||||||
) : base(
|
) : base(
|
||||||
providedFor: nameof(XWebinar),
|
providedFor: nameof(XWebinar),
|
||||||
provider: provider
|
fileProvider: fileProvider
|
||||||
)
|
)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|||||||
+255
-184
@@ -3,9 +3,11 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using IdentityModel.Client;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using MongoDB.Driver;
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Extensions;
|
using xDataService.Extensions;
|
||||||
@@ -549,21 +551,25 @@ namespace xWebinarService.Providers
|
|||||||
public async Task<IEnumerable<XWebinarDto>> GetWebinars()
|
public async Task<IEnumerable<XWebinarDto>> GetWebinars()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var list = await WebinarRepository.GetAllAsync();
|
var entities = WebinarRepository
|
||||||
var result = await list.SelectAsync(async l => await ToXWebinarDto(l));
|
.AsQueryable()
|
||||||
|
.ToList();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
var result = new List<XWebinarDto>();
|
||||||
}
|
if (!entities.IsNull() && entities.HasChild())
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieve all Exists Webinar Ids ...
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public IEnumerable<Guid> GetWebinarIds()
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = WebinarRepository.AsQueryable().Select(l => l.Id);
|
foreach (var entity in entities)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var dto = await ToXWebinarDto(entity);
|
||||||
|
if (!dto.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
result.Add(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -823,75 +829,6 @@ namespace xWebinarService.Providers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Query Webinar Ids ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="query"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public XQueryResult<Guid> QueryWebinarIds(XQuery query)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Validate ...
|
|
||||||
if (query.IsNull())
|
|
||||||
{
|
|
||||||
XException.InvalidArgs.Throw();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Normalize ...
|
|
||||||
query = query.NormalizeQuery(DataSercviceConfiguration);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Since in Resourceable Entities we have to Search on Locales
|
|
||||||
// we Must Implement Senario Custom ...
|
|
||||||
var items = GetWebinarIds();
|
|
||||||
var totalItemsCount = items.Count();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Apply Filter ...
|
|
||||||
if (!query.Filter.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
items = items
|
|
||||||
.Where(i => i.ToString().ToNormalString().Contains(query.Filter));
|
|
||||||
}
|
|
||||||
int filteredItemsCount = items.Count();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Count Pages ...
|
|
||||||
var totalPagesCount = query.CountPages(totalItemsCount);
|
|
||||||
var filteredPagesCount = query.CountPages(filteredItemsCount);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Apply Paging and Sorting ...
|
|
||||||
if (totalItemsCount > 0 &&
|
|
||||||
filteredItemsCount > 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Apply Paging ...
|
|
||||||
items = items.ApplyPaging(
|
|
||||||
query.Page,
|
|
||||||
query.PageSize
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Prepare Result ...
|
|
||||||
var result = new XQueryResult<Guid>
|
|
||||||
{
|
|
||||||
Items = items,
|
|
||||||
Page = query.Page,
|
|
||||||
PageSize = query.PageSize,
|
|
||||||
TotalPages = totalPagesCount,
|
|
||||||
TotalItems = totalItemsCount,
|
|
||||||
TotalFilteredPages = filteredPagesCount,
|
|
||||||
TotalFilteredItems = filteredItemsCount
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove Specified Webinar ...
|
/// Remove Specified Webinar ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -971,10 +908,16 @@ namespace xWebinarService.Providers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var medias = await WebinarFileProvider.GetAllFor(entity.Id);
|
var medias = await WebinarFileProvider.GetAllReferences(entity.Id);
|
||||||
if (!medias.IsNull() && medias.HasChild())
|
if (!medias.IsNull() && medias.HasChild())
|
||||||
{
|
{
|
||||||
await RemoveFiles(entity.Id, string.Empty, userInfo);
|
//
|
||||||
|
await RemoveFiles(
|
||||||
|
id: entity.Id,
|
||||||
|
ids: string.Empty,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
@@ -1005,11 +948,13 @@ namespace xWebinarService.Providers
|
|||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
/// <param name="subscriberId"></param>
|
/// <param name="subscriberId"></param>
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> Subscribe(
|
public async Task<bool> Subscribe(
|
||||||
Guid webinarId,
|
Guid webinarId,
|
||||||
string subscriberId,
|
string subscriberId,
|
||||||
string connectionId = null
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1020,10 +965,11 @@ namespace xWebinarService.Providers
|
|||||||
result =
|
result =
|
||||||
!webinarId.IsNull() &&
|
!webinarId.IsNull() &&
|
||||||
!webinarId.IsDefaultGuid() &&
|
!webinarId.IsDefaultGuid() &&
|
||||||
!subscriberId.IsNullOrEmpty();
|
!subscriberId.IsNullOrEmpty() &&
|
||||||
|
!userInfo.IsNullOrDefault();
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
XException.InvalidArgs.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1031,38 +977,46 @@ namespace xWebinarService.Providers
|
|||||||
result = await WebinarRepository.IsExistsAsync(webinarId);
|
result = await WebinarRepository.IsExistsAsync(webinarId);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
XException.NotFound.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve Webinar Entity ...
|
// Retrieve Webinar Entity ...
|
||||||
var webinar = await WebinarRepository.GetAsync(webinarId);
|
var webinar = await WebinarRepository.GetAsync(webinarId);
|
||||||
|
result = !webinar.IsNullOrDefault();
|
||||||
//
|
|
||||||
// Check Webinar Enabled ...
|
|
||||||
result = webinar.Enabled;
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
XException.ActionFailed.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Permissions ...
|
||||||
|
result =
|
||||||
|
userInfo.UserId == webinar.OwnerId ||
|
||||||
|
webinar.Type == XWebinarType.Public ||
|
||||||
|
userInfo.Roles.Any(r => r.ToNormalString() == "admin");
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
XException.NotAllowed.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check User Exists ...
|
// Check User Exists ...
|
||||||
var device = IdentityProvider.GetDevice();
|
var device = IdentityProvider.GetDevice();
|
||||||
XOpenActionUserInfoDto userInfo = null;
|
XOpenActionUserInfoDto subscriber = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
userInfo = await IdentityProvider.GetUserInfo(
|
subscriber = await IdentityProvider.GetUserInfo(
|
||||||
device: device,
|
device: device,
|
||||||
userSelectByParam: subscriberId
|
userSelectByParam: subscriberId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
result = !userInfo.IsNullOrDefault();
|
result = !subscriber.IsNullOrDefault();
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
XException.NotFound.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1094,10 +1048,12 @@ namespace xWebinarService.Providers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
/// <param name="subscriberId"></param>
|
/// <param name="subscriberId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> IsSubscribed(
|
public async Task<bool> IsSubscribed(
|
||||||
Guid webinarId,
|
Guid webinarId,
|
||||||
string subscriberId
|
string subscriberId,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1108,37 +1064,50 @@ namespace xWebinarService.Providers
|
|||||||
result =
|
result =
|
||||||
!webinarId.IsNull() &&
|
!webinarId.IsNull() &&
|
||||||
!webinarId.IsDefaultGuid() &&
|
!webinarId.IsDefaultGuid() &&
|
||||||
|
!userInfo.IsNullOrDefault() &&
|
||||||
!subscriberId.IsNullOrEmpty();
|
!subscriberId.IsNullOrEmpty();
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
XException.InvalidArgs.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Webinar Exists ...
|
// Check Webinar Exists ...
|
||||||
result = await WebinarRepository.IsExistsAsync(webinarId);
|
var webinar = await WebinarRepository.GetAsync(webinarId);
|
||||||
|
result = !webinar.IsNullOrDefault();
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
XException.NotFound.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Permission ...
|
||||||
|
result =
|
||||||
|
userInfo.UserId == subscriberId ||
|
||||||
|
userInfo.UserId == webinar.OwnerId ||
|
||||||
|
userInfo.Roles.Any(r => r.ToNormalString() == "admin");
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
XException.NotAllowed.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check User Exists ...
|
// Check User Exists ...
|
||||||
var device = IdentityProvider.GetDevice();
|
var device = IdentityProvider.GetDevice();
|
||||||
XOpenActionUserInfoDto userInfo = null;
|
XOpenActionUserInfoDto suscriber = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
userInfo = await IdentityProvider.GetUserInfo(
|
suscriber = await IdentityProvider.GetUserInfo(
|
||||||
device: device,
|
device: device,
|
||||||
userSelectByParam: subscriberId
|
userSelectByParam: subscriberId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
result = !userInfo.IsNullOrDefault();
|
result = !suscriber.IsNullOrDefault();
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
XException.NotFound.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1157,11 +1126,13 @@ namespace xWebinarService.Providers
|
|||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
/// <param name="subscriberId"></param>
|
/// <param name="subscriberId"></param>
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> Unsubscribe(
|
public async Task<bool> Unsubscribe(
|
||||||
Guid webinarId,
|
Guid webinarId,
|
||||||
string subscriberId,
|
string subscriberId,
|
||||||
string connectionId = null
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1172,26 +1143,44 @@ namespace xWebinarService.Providers
|
|||||||
result =
|
result =
|
||||||
!webinarId.IsNull() &&
|
!webinarId.IsNull() &&
|
||||||
!webinarId.IsDefaultGuid() &&
|
!webinarId.IsDefaultGuid() &&
|
||||||
|
!userInfo.IsNullOrDefault() &&
|
||||||
!subscriberId.IsNullOrEmpty();
|
!subscriberId.IsNullOrEmpty();
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
XException.InvalidArgs.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Subscription ..
|
// Check Subscription ...
|
||||||
result = await IsSubscribed(
|
result = await IsSubscribed(
|
||||||
webinarId: webinarId,
|
webinarId: webinarId,
|
||||||
|
userInfo: userInfo,
|
||||||
subscriberId: subscriberId
|
subscriberId: subscriberId
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
XException.NotFound.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve Webinar ...
|
// Retrieve Webinar ...
|
||||||
var webinar = await WebinarRepository.GetAsync(webinarId);
|
var webinar = await WebinarRepository.GetAsync(webinarId);
|
||||||
|
result = !webinar.IsNullOrDefault();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
XException.ActionFailed.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Permissions ...
|
||||||
|
result =
|
||||||
|
userInfo.UserId == subscriberId ||
|
||||||
|
userInfo.UserId == webinar.OwnerId ||
|
||||||
|
userInfo.Roles.Any(r => r.ToNormalString() == "admin");
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
XException.NotAllowed.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve Subscription Entity ...
|
// Retrieve Subscription Entity ...
|
||||||
@@ -1220,10 +1209,12 @@ namespace xWebinarService.Providers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
/// <param name="subscriberId"></param>
|
/// <param name="subscriberId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<XWebinarSubscriberDto> GetSubscriber(
|
public async Task<XWebinarSubscriberDto> GetSubscriber(
|
||||||
Guid webinarId,
|
Guid webinarId,
|
||||||
string subscriberId
|
string subscriberId,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1246,6 +1237,17 @@ namespace xWebinarService.Providers
|
|||||||
XException.NotFound.Throw();
|
XException.NotFound.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Permissions ...
|
||||||
|
isValid =
|
||||||
|
userInfo.UserId == subscriberId ||
|
||||||
|
userInfo.UserId == webinar.OwnerId ||
|
||||||
|
userInfo.Roles.Any(r => r.ToNormalString() == "admin");
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.NotAllowed.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve Entity and Validate it ...
|
// Retrieve Entity and Validate it ...
|
||||||
var entity = await WebinarSubscriberRepository.FindOneAsync(e =>
|
var entity = await WebinarSubscriberRepository.FindOneAsync(e =>
|
||||||
@@ -1268,15 +1270,18 @@ namespace xWebinarService.Providers
|
|||||||
/// Get all Specified Webinars Subscribers ...
|
/// Get all Specified Webinars Subscribers ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<IEnumerable<XWebinarSubscriberDto>> GetSubscribers(
|
public async Task<IEnumerable<XWebinarSubscriberDto>> GetSubscribers(
|
||||||
Guid webinarId
|
Guid webinarId,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Validate ...
|
// Validate ...
|
||||||
bool isValid =
|
bool isValid =
|
||||||
!webinarId.IsNull() &&
|
!webinarId.IsNull() &&
|
||||||
|
!userInfo.IsNullOrDefault() &&
|
||||||
!webinarId.IsDefaultGuid();
|
!webinarId.IsDefaultGuid();
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
@@ -1292,6 +1297,21 @@ namespace xWebinarService.Providers
|
|||||||
XException.NotFound.Throw();
|
XException.NotFound.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Permissions ...
|
||||||
|
isValid =
|
||||||
|
(await IsSubscribed(
|
||||||
|
userInfo: userInfo,
|
||||||
|
webinarId: webinarId,
|
||||||
|
subscriberId: userInfo.UserId
|
||||||
|
)) ||
|
||||||
|
userInfo.UserId == webinar.OwnerId ||
|
||||||
|
userInfo.Roles.Any(r => r.ToNormalString() == "admin");
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.NotAllowed.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
var subscribers = await WebinarSubscriberRepository.FindManyAsync(e =>
|
var subscribers = await WebinarSubscriberRepository.FindManyAsync(e =>
|
||||||
e.WebinarId == webinarId
|
e.WebinarId == webinarId
|
||||||
@@ -1311,10 +1331,12 @@ namespace xWebinarService.Providers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="webinarId"></param>
|
/// <param name="webinarId"></param>
|
||||||
/// <param name="query"></param>
|
/// <param name="query"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<XQueryResult<XWebinarSubscriberDto>> QuerySubscribers(
|
public async Task<XQueryResult<XWebinarSubscriberDto>> QuerySubscribers(
|
||||||
Guid webinarId,
|
Guid webinarId,
|
||||||
XQuery query
|
XQuery query,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1322,7 +1344,8 @@ namespace xWebinarService.Providers
|
|||||||
bool isValid =
|
bool isValid =
|
||||||
!query.IsNull() &&
|
!query.IsNull() &&
|
||||||
!webinarId.IsNull() &&
|
!webinarId.IsNull() &&
|
||||||
!webinarId.IsDefaultGuid();
|
!webinarId.IsDefaultGuid() &&
|
||||||
|
!userInfo.IsNullOrDefault();
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
XException.InvalidArgs.Throw();
|
XException.InvalidArgs.Throw();
|
||||||
@@ -1334,15 +1357,32 @@ namespace xWebinarService.Providers
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Check Webinar Exists ...
|
// Check Webinar Exists ...
|
||||||
isValid = await WebinarRepository.IsExistsAsync(webinarId);
|
var webinar = await WebinarRepository.GetAsync(webinarId);
|
||||||
|
isValid = !webinar.IsNullOrDefault();
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
XException.NotFound.Throw();
|
XException.NotFound.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Permissions ...
|
||||||
|
isValid =
|
||||||
|
(await IsSubscribed(
|
||||||
|
userInfo: userInfo,
|
||||||
|
webinarId: webinarId,
|
||||||
|
subscriberId: userInfo.UserId
|
||||||
|
)) ||
|
||||||
|
userInfo.UserId == webinar.OwnerId ||
|
||||||
|
userInfo.Roles.Any(r => r.ToNormalString() == "admin");
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.NotAllowed.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve all Items ...
|
// Retrieve all Items ...
|
||||||
var items = await GetSubscribers(
|
var items = await GetSubscribers(
|
||||||
|
userInfo: userInfo,
|
||||||
webinarId: webinarId
|
webinarId: webinarId
|
||||||
);
|
);
|
||||||
var totalItemsCount = items.Count();
|
var totalItemsCount = items.Count();
|
||||||
@@ -1488,7 +1528,7 @@ namespace xWebinarService.Providers
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
var result = await WebinarFileProvider.Remove(
|
var result = await WebinarFileProvider.RemoveFiles(
|
||||||
forProvidedId: id,
|
forProvidedId: id,
|
||||||
ids: ids,
|
ids: ids,
|
||||||
userInfo: userInfo,
|
userInfo: userInfo,
|
||||||
@@ -1501,22 +1541,38 @@ namespace xWebinarService.Providers
|
|||||||
/// Get Webinar Files ...
|
/// Get Webinar Files ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<IEnumerable<XFileDto>> GetFiles(Guid id)
|
public async Task<IEnumerable<XFileDto>> GetFiles(
|
||||||
|
Guid id,
|
||||||
|
XUserClaimsInfoDto userInfo = null
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = new List<XFileDto>();
|
// Validate ...
|
||||||
|
var isValid =
|
||||||
|
!id.IsNull() &&
|
||||||
|
!id.IsDefaultGuid() &&
|
||||||
|
!userInfo.IsNullOrDefault();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
var dto = await GetWebinar(id);
|
// Check Webinar Exists ...
|
||||||
if (!dto.IsNullOrDefault())
|
var webinar = await WebinarRepository.GetAsync(id);
|
||||||
|
isValid = !webinar.IsNullOrDefault();
|
||||||
|
if (!isValid)
|
||||||
{
|
{
|
||||||
//
|
XException.NotFound.Throw();
|
||||||
result = (await WebinarFileProvider
|
|
||||||
.GetAllFor(id))
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = (await WebinarFileProvider
|
||||||
|
.GetAllReferences(id))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1543,17 +1599,6 @@ namespace xWebinarService.Providers
|
|||||||
XException.InvalidArgs.Throw();
|
XException.InvalidArgs.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Check Specified File is Refrenced to Specified Webinar ...
|
|
||||||
var files = await WebinarFileProvider.GetAllFor(id);
|
|
||||||
isValid = !files.IsNull() &&
|
|
||||||
files.HasChild() &&
|
|
||||||
files.Any(f => f.Id == fileId);
|
|
||||||
if (!isValid)
|
|
||||||
{
|
|
||||||
XException.NotFound.Throw();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
var result = await WebinarFileProvider.Stream(fileId);
|
var result = await WebinarFileProvider.Stream(fileId);
|
||||||
return result;
|
return result;
|
||||||
@@ -1581,17 +1626,6 @@ namespace xWebinarService.Providers
|
|||||||
XException.InvalidArgs.Throw();
|
XException.InvalidArgs.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Check Specified File is Refrenced to Specified Webinar ...
|
|
||||||
var files = await WebinarFileProvider.GetAllFor(id);
|
|
||||||
isValid = !files.IsNull() &&
|
|
||||||
files.HasChild() &&
|
|
||||||
files.Any(f => f.Id == fileId);
|
|
||||||
if (!isValid)
|
|
||||||
{
|
|
||||||
XException.NotFound.Throw();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
var result = await WebinarFileProvider.Download(fileId);
|
var result = await WebinarFileProvider.Download(fileId);
|
||||||
return result;
|
return result;
|
||||||
@@ -1623,8 +1657,11 @@ namespace xWebinarService.Providers
|
|||||||
!id.IsNull() &&
|
!id.IsNull() &&
|
||||||
!id.IsDefaultGuid() &&
|
!id.IsDefaultGuid() &&
|
||||||
!userInfo.IsNullOrDefault();
|
!userInfo.IsNullOrDefault();
|
||||||
if (isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Permissions ...
|
// Check Permissions ...
|
||||||
isValid = await HasPermission(
|
isValid = await HasPermission(
|
||||||
@@ -1641,13 +1678,18 @@ namespace xWebinarService.Providers
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Attached Tag to Webinar ...
|
// Attached Tag to Webinar ...
|
||||||
await WebinarTagProvider.Attach(tag, id, connectionId);
|
await WebinarTagProvider.AddReference(
|
||||||
|
tag: tag,
|
||||||
|
forIndex: 0,
|
||||||
|
providedForId: id,
|
||||||
|
connectionId: connectionId
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (forceAttachToFiles)
|
if (forceAttachToFiles)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var medias = await WebinarFileProvider.GetAllFor(id);
|
var medias = await WebinarFileProvider.GetAllReferences(id);
|
||||||
isValid = !medias.IsNull() && medias.HasChild();
|
isValid = !medias.IsNull() && medias.HasChild();
|
||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
@@ -1655,9 +1697,9 @@ namespace xWebinarService.Providers
|
|||||||
foreach (var media in medias)
|
foreach (var media in medias)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
await WebinarFileProvider.Provider.AttachTag(
|
await WebinarFileProvider.FileProvider.AttachTag(
|
||||||
id: media.Id,
|
|
||||||
tag: tag,
|
tag: tag,
|
||||||
|
id: media.Id,
|
||||||
userInfo: userInfo,
|
userInfo: userInfo,
|
||||||
connectionId: connectionId
|
connectionId: connectionId
|
||||||
);
|
);
|
||||||
@@ -1667,7 +1709,6 @@ namespace xWebinarService.Providers
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detach Tag fro Specified File ...
|
/// Detach Tag fro Specified File ...
|
||||||
@@ -1691,8 +1732,11 @@ namespace xWebinarService.Providers
|
|||||||
var isValid = !tag.IsNullOrEmpty() &&
|
var isValid = !tag.IsNullOrEmpty() &&
|
||||||
!id.IsNull() &&
|
!id.IsNull() &&
|
||||||
!id.IsDefaultGuid();
|
!id.IsDefaultGuid();
|
||||||
if (isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Permissions ...
|
// Check Permissions ...
|
||||||
isValid = await HasPermission(
|
isValid = await HasPermission(
|
||||||
@@ -1708,13 +1752,18 @@ namespace xWebinarService.Providers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
await WebinarTagProvider.Detach(tag, id, connectionId);
|
await WebinarTagProvider
|
||||||
|
.RemoveReference(
|
||||||
|
tag: tag,
|
||||||
|
providedForId: id,
|
||||||
|
connectionId: connectionId
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (forceDetachFromFiles)
|
if (forceDetachFromFiles)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var medias = await WebinarFileProvider.GetAllFor(id);
|
var medias = await WebinarFileProvider.GetAllReferences(id);
|
||||||
isValid = !medias.IsNull() && medias.HasChild();
|
isValid = !medias.IsNull() && medias.HasChild();
|
||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
@@ -1722,9 +1771,9 @@ namespace xWebinarService.Providers
|
|||||||
foreach (var media in medias)
|
foreach (var media in medias)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
await WebinarFileProvider.Provider.DetachTag(
|
await WebinarFileProvider.FileProvider.DetachTag(
|
||||||
id: media.Id,
|
|
||||||
tag: tag,
|
tag: tag,
|
||||||
|
id: media.Id,
|
||||||
userInfo: userInfo,
|
userInfo: userInfo,
|
||||||
connectionId: connectionId
|
connectionId: connectionId
|
||||||
);
|
);
|
||||||
@@ -1734,7 +1783,6 @@ namespace xWebinarService.Providers
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attach Tags for Specified File ...
|
/// Attach Tags for Specified File ...
|
||||||
@@ -1759,8 +1807,11 @@ namespace xWebinarService.Providers
|
|||||||
tags.HasChild() &&
|
tags.HasChild() &&
|
||||||
!id.IsNull() &&
|
!id.IsNull() &&
|
||||||
!id.IsDefaultGuid();
|
!id.IsDefaultGuid();
|
||||||
if (isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Permissions ...
|
// Check Permissions ...
|
||||||
isValid = await HasPermission(
|
isValid = await HasPermission(
|
||||||
@@ -1780,17 +1831,16 @@ namespace xWebinarService.Providers
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
await AttachTag(
|
await AttachTag(
|
||||||
tag,
|
id: id,
|
||||||
id,
|
tag: tag,
|
||||||
userInfo,
|
userInfo: userInfo,
|
||||||
connectionId,
|
connectionId: connectionId,
|
||||||
forceAttachToFiles
|
forceAttachToFiles: forceAttachToFiles
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detach Tags for Specified File ...
|
/// Detach Tags for Specified File ...
|
||||||
@@ -1815,8 +1865,11 @@ namespace xWebinarService.Providers
|
|||||||
tags.HasChild() &&
|
tags.HasChild() &&
|
||||||
!id.IsNull() &&
|
!id.IsNull() &&
|
||||||
!id.IsDefaultGuid();
|
!id.IsDefaultGuid();
|
||||||
if (isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Permissions ...
|
// Check Permissions ...
|
||||||
isValid = await HasPermission(
|
isValid = await HasPermission(
|
||||||
@@ -1836,22 +1889,22 @@ namespace xWebinarService.Providers
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
await DetachTag(
|
await DetachTag(
|
||||||
tag,
|
id: id,
|
||||||
id,
|
tag: tag,
|
||||||
userInfo,
|
userInfo: userInfo,
|
||||||
connectionId,
|
connectionId: connectionId,
|
||||||
forceDetachFromFiles
|
forceDetachFromFiles: forceDetachFromFiles
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detach all Attached Tags for Specified File ...
|
/// Detach all Attached Tags for Specified Webinar ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="forceDetachFromFiles"></param>
|
/// <param name="forceDetachFromFiles"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
@@ -1865,8 +1918,11 @@ namespace xWebinarService.Providers
|
|||||||
//
|
//
|
||||||
// Validate ...
|
// Validate ...
|
||||||
var isValid = !id.IsNull() && !id.IsDefaultGuid();
|
var isValid = !id.IsNull() && !id.IsDefaultGuid();
|
||||||
if (isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Permissions ...
|
// Check Permissions ...
|
||||||
isValid = await HasPermission(
|
isValid = await HasPermission(
|
||||||
@@ -1882,22 +1938,25 @@ namespace xWebinarService.Providers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var tags = await WebinarTagProvider.RemoveTagsFor(id, connectionId);
|
await WebinarTagProvider.RemoveReferences(
|
||||||
|
providedForId: id,
|
||||||
|
connectionId: connectionId
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (forceDetachFromFiles)
|
if (forceDetachFromFiles)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var medias = await WebinarFileProvider.GetAllFor(id);
|
var medias = await WebinarFileProvider.GetAllReferences(id);
|
||||||
if (!medias.IsNull() && medias.HasChild())
|
isValid = !medias.IsNull() && medias.HasChild();
|
||||||
|
if (isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
foreach (var media in medias)
|
foreach (var media in medias)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
await WebinarFileProvider.Provider.DetachTags(
|
await WebinarFileProvider.FileProvider.TagProvider.RemoveReferences(
|
||||||
id: media.Id,
|
providedForId: media.Id,
|
||||||
userInfo: userInfo,
|
|
||||||
connectionId: connectionId
|
connectionId: connectionId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1906,7 +1965,6 @@ namespace xWebinarService.Providers
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve Specified Webinar's Tags ...
|
/// Retrieve Specified Webinar's Tags ...
|
||||||
@@ -1930,19 +1988,32 @@ namespace xWebinarService.Providers
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Checking Permissions ...
|
// Check Webinar Wxists ...
|
||||||
|
var webinar = await WebinarRepository.GetAsync(id);
|
||||||
//
|
isValid = !webinar.IsNullOrDefault();
|
||||||
// Checking Exists ...
|
|
||||||
isValid = await WebinarRepository.IsExistsAsync(id);
|
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
XException.NotFound.Throw();
|
XException.NotFound.Throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Permissions ...
|
||||||
|
isValid =
|
||||||
|
(await IsSubscribed(
|
||||||
|
webinarId: id,
|
||||||
|
userInfo: userInfo,
|
||||||
|
subscriberId: userInfo.UserId
|
||||||
|
)) ||
|
||||||
|
userInfo.UserId == webinar.OwnerId ||
|
||||||
|
userInfo.Roles.Any(r => r.ToNormalString() == "admin");
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.NotAllowed.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reading Tags Dto List ...
|
// Reading Tags Dto List ...
|
||||||
var tagsDtos = await WebinarTagProvider.GetTags(id);
|
var tagsDtos = await WebinarTagProvider.GetAllReferences(id);
|
||||||
|
|
||||||
//
|
//
|
||||||
var result = new List<string>();
|
var result = new List<string>();
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ namespace xWebinarService.Providers
|
|||||||
public XWebinarTagProvider(
|
public XWebinarTagProvider(
|
||||||
IXTagProvider tagProvider
|
IXTagProvider tagProvider
|
||||||
) : base(
|
) : base(
|
||||||
nameof(XWebinar),
|
providedFor: nameof(XWebinar),
|
||||||
tagProvider
|
tagProvider: tagProvider
|
||||||
)
|
)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user