56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
using System;
|
|
using xCommons.Extensions;
|
|
using xTagService.Providers;
|
|
using xIdentityModels.Models;
|
|
using xContentService.Constants;
|
|
using xContentService.Interfaces;
|
|
using xContentService.Models.Dtos;
|
|
using xContentService.Providers.Dtos;
|
|
using xContentService.Interfaces.Dtos;
|
|
using xContentService.Models.Entities;
|
|
|
|
namespace xContentService.Providers
|
|
{
|
|
public class XContentTagProvided : XBaseTagProvided<XContent, XContentDto, Guid, XContentDtoHub>, IXContentTagProvided
|
|
{
|
|
public XContentTagProvided(
|
|
IXContentTagProvider tagProvider,
|
|
IXContentServiceProvider provider
|
|
) : base(
|
|
provider: provider,
|
|
tagProvider: tagProvider,
|
|
permittedRoles: [XContentServiceConstants.XAdminRole]
|
|
)
|
|
{ }
|
|
|
|
public override bool IsOwned(
|
|
XContent item,
|
|
XUserClaimsInfoDto userInfo
|
|
)
|
|
{
|
|
//
|
|
var result =
|
|
!item.IsNullOrDefault() &&
|
|
!userInfo.IsNullOrDefault() &&
|
|
item.OwnerId == userInfo.UserId;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public override bool IsOwned(
|
|
XContentDto item,
|
|
XUserClaimsInfoDto userInfo
|
|
)
|
|
{
|
|
//
|
|
var result =
|
|
!item.IsNullOrDefault() &&
|
|
!userInfo.IsNullOrDefault() &&
|
|
item.OwnerId == userInfo.UserId;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
}
|
|
} |