fix 营业点权限控制优化
This commit is contained in:
@@ -55,11 +55,22 @@ public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService
|
|||||||
var role = _currentUser.GetUserClaim(ClaimTypes.Role);
|
var role = _currentUser.GetUserClaim(ClaimTypes.Role);
|
||||||
var isAdmin = role == "admin" || role == "tenant-admin";
|
var isAdmin = role == "admin" || role == "tenant-admin";
|
||||||
|
|
||||||
var codes = await _dbContext.Queryable<BusinessPlaceManagerRelationshipEntity>()
|
var codes = new List<Guid>();
|
||||||
.WhereIF(!isAdmin, x => x.ManagerUserId == userId)
|
if (isAdmin)
|
||||||
|
{
|
||||||
|
codes = await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||||
|
.Select(x => x.Code)
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
codes = await _dbContext.Queryable<BusinessPlaceManagerRelationshipEntity>()
|
||||||
|
.Where(x => x.ManagerUserId == userId)
|
||||||
.Select(x => x.BusinessPlaceCode)
|
.Select(x => x.BusinessPlaceCode)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return await _dbContext.Queryable<BusinessPlaceEntity>()
|
return await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||||
.Where(x => codes.Contains(x.Code))
|
.Where(x => codes.Contains(x.Code))
|
||||||
|
|||||||
Reference in New Issue
Block a user