clean up and various little improvements after search for static wasted memory objects (not found) At this point it appears I don't have any leaks and it's all pretty efficient.
This commit is contained in:
@@ -1,31 +1,10 @@
|
||||
|
||||
namespace AyaNova.Api.ControllerHelpers
|
||||
{
|
||||
|
||||
|
||||
//return the response with optional readonly flag
|
||||
//this exists basically for consistency and to reduce the bandwidth if not readonly which is most common
|
||||
//UPDATE: Actually, there's no way for the biz object to set the readonly status and the client doesn't really use it at this point 2020-05-18 09:09:29
|
||||
//in theory it should be a non db property of the model if it's going to be used at all so removing it entirely from response as a separate property
|
||||
public static class ApiOkResponse
|
||||
{
|
||||
public static object Response(object result)
|
||||
{
|
||||
// if (isReadOnly)
|
||||
// {
|
||||
// return new
|
||||
// {
|
||||
// Data = result,
|
||||
// ReadOnly = true
|
||||
// };
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
return new { Data = result };
|
||||
//}
|
||||
|
||||
return new { Data = result };
|
||||
}
|
||||
}//eoc
|
||||
|
||||
|
||||
}//eons
|
||||
@@ -56,7 +56,7 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// <param name="objectType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasAnyRole(AuthorizationRoles currentUserRoles, AyaType objectType)
|
||||
{
|
||||
{
|
||||
var RoleSet = BizRoles.GetRoleSet(objectType);
|
||||
var AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change | RoleSet.Select;
|
||||
return currentUserRoles.HasAnyFlags(AllowedRoles);
|
||||
@@ -120,14 +120,6 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
var RoleSet = BizRoles.GetRoleSet(objectType);
|
||||
var AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
return currentUserRoles.HasAnyFlags(AllowedRoles);
|
||||
|
||||
// if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).Change))
|
||||
// return true;
|
||||
|
||||
// if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).ReadFullRecord))
|
||||
// return true;
|
||||
|
||||
//return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,14 +146,10 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
{
|
||||
if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).Change))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MODIFY
|
||||
/// </summary>
|
||||
@@ -172,7 +160,6 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
internal static bool HasModifyRole(IDictionary<object, object> HttpContextItems, AyaType objectType)
|
||||
{
|
||||
AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems);
|
||||
|
||||
return HasModifyRole(currentUserRoles, objectType);
|
||||
}
|
||||
|
||||
@@ -219,8 +206,6 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
{
|
||||
if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).Change))
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user