This commit is contained in:
@@ -248,18 +248,25 @@ namespace AyaNova.Biz
|
|||||||
AuthorizationRoles effectiveRoles = CurrentUserRoles;
|
AuthorizationRoles effectiveRoles = CurrentUserRoles;
|
||||||
if (overrideUserId != 0)
|
if (overrideUserId != 0)
|
||||||
{
|
{
|
||||||
var effectiveUser=await ct.User.FirstOrDefaultAsync(z => z.Id == overrideUserId);
|
var effectiveUser = await ct.User.FirstOrDefaultAsync(z => z.Id == overrideUserId);
|
||||||
if (effectiveUser==null)
|
if (effectiveUser == null)
|
||||||
{
|
{
|
||||||
var msg = $"Override user id specifies user that doesn't exist({overrideUserId}) cannot generate report {report.Name}";
|
var msg = $"Override user id specifies user that doesn't exist({overrideUserId}) cannot generate report {report.Name}";
|
||||||
log.LogError(msg);
|
log.LogError(msg);
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "UserId", msg);
|
AddError(ApiErrorCode.NOT_FOUND, "UserId", msg);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
effectiveRoles=effectiveUser.Roles;
|
effectiveRoles = effectiveUser.Roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(effectiveRoles, report.ObjectType))
|
||||||
|
{
|
||||||
|
AddError(ApiErrorCode.NOT_AUTHORIZED, null, $"User not authorized for {report.ObjectType} type object");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Get data
|
||||||
|
|
||||||
|
|
||||||
//initialization
|
//initialization
|
||||||
|
|||||||
Reference in New Issue
Block a user