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