feat:完成权限相关、全局配置、优化细节
This commit is contained in:
@@ -48,9 +48,18 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
|
||||
public string? PrivateCode { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
|
||||
public List<long> PermissionUserIds { get; set; }
|
||||
|
||||
public UserGetListOutputDto User { get; set; }
|
||||
|
||||
public void SetBan()
|
||||
{
|
||||
this.Title = DiscussConst.˽<EFBFBD><EFBFBD>;
|
||||
this.Introduction = "";
|
||||
this.Cover = null;
|
||||
//<2F><><EFBFBD><EFBFBD>ֹ
|
||||
this.IsBan = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,20 +78,19 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
|
||||
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><C7BD>Լ<EFBFBD><D4BC>ɼ<EFBFBD><C9BC><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD>ǵ<EFBFBD>ǰ<EFBFBD><C7B0>¼<EFBFBD>û<EFBFBD>
|
||||
if (dto.User.Id != userId)
|
||||
{
|
||||
dto.Title = DiscussConst.˽<EFBFBD><EFBFBD>;
|
||||
dto.Introduction= "";
|
||||
dto.Cover = null;
|
||||
//<2F><><EFBFBD><EFBFBD>ֹ
|
||||
dto.IsBan = true;
|
||||
dto.SetBan();
|
||||
}
|
||||
break;
|
||||
case DiscussPermissionTypeEnum.User:
|
||||
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ֿɼ<D6BF><C9BC><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD>ǵ<EFBFBD>ǰ<EFBFBD><C7B0>¼<EFBFBD>û<EFBFBD> Ҳ <20><><EFBFBD>ڿɼ<DABF><C9BC>û<EFBFBD><C3BB>б<EFBFBD><D0B1><EFBFBD>
|
||||
if (dto.User.Id != userId && !dto.PermissionUserIds.Contains(userId))
|
||||
{
|
||||
dto.SetBan();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos
|
||||
public string? PrivateCode { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
public DiscussPermissionTypeEnum PermissionType { get; set; }
|
||||
|
||||
public List<long> PermissionUserIds { get; set; }
|
||||
public UserGetListOutputDto User { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
|
||||
public string Content { get; set; }
|
||||
public string? Color { get; set; }
|
||||
|
||||
public List<long> PermissionUserIds { get; set; }
|
||||
|
||||
public DiscussPermissionTypeEnum PermissionType { get; set; }
|
||||
|
||||
|
||||
@@ -141,6 +141,13 @@ namespace Yi.BBS.Application.Forum
|
||||
throw new UserFriendlyException(DiscussConst.私密);
|
||||
}
|
||||
}
|
||||
if (discuss.PermissionType == DiscussPermissionTypeEnum.User)
|
||||
{
|
||||
if (discuss.CreatorId != _currentUser.Id && !discuss.PermissionUserIds.Contains(_currentUser.Id))
|
||||
{
|
||||
throw new UserFriendlyException(DiscussConst.私密);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@ namespace Yi.BBS.Domain.Shared.Forum.ConstClasses
|
||||
{
|
||||
public const string 主题不存在 = "传入的主题id不存在";
|
||||
|
||||
public const string 私密 = "【私密】您无该主题权限";
|
||||
public const string 私密 = "【私密】您无该主题权限,可联系作者申请开放";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@
|
||||
封面
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.BBS.Domain.Forum.Entities.DiscussEntity.PermissionUserIds">
|
||||
<summary>
|
||||
当PermissionType为部分用户时候,以下列表中的用户+创建者 代表拥有权限
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.BBS.Domain.Forum.ForumManager">
|
||||
<summary>
|
||||
论坛模块的领域服务
|
||||
|
||||
@@ -54,5 +54,12 @@ namespace Yi.BBS.Domain.Forum.Entities
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当PermissionType为部分用户时候,以下列表中的用户+创建者 代表拥有权限
|
||||
/// </summary>
|
||||
[SugarColumn(IsJson = true)]//使用json处理
|
||||
public List<long> PermissionUserIds { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user