rename all variants of naming that hold an AyaType value to "aType" (parameter) / "AType" (not parameter) everywhere front and back; "ayType", "objectType", "oType" all are used in various areas
This commit is contained in:
@@ -41,23 +41,23 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// any access at all?
|
||||
/// </summary>
|
||||
/// <param name="HttpContextItems"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasAnyRole(IDictionary<object, object> HttpContextItems, AyaType objectType)
|
||||
internal static bool HasAnyRole(IDictionary<object, object> HttpContextItems, AyaType aType)
|
||||
{
|
||||
AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems);
|
||||
return HasAnyRole(currentUserRoles, objectType);
|
||||
return HasAnyRole(currentUserRoles, aType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// User has any access at all to this object?
|
||||
/// </summary>
|
||||
/// <param name="currentUserRoles"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasAnyRole(AuthorizationRoles currentUserRoles, AyaType objectType)
|
||||
internal static bool HasAnyRole(AuthorizationRoles currentUserRoles, AyaType aType)
|
||||
{
|
||||
var RoleSet = BizRoles.GetRoleSet(objectType);
|
||||
var RoleSet = BizRoles.GetRoleSet(aType);
|
||||
if (RoleSet == null) return false;
|
||||
var AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change | RoleSet.Select;
|
||||
return currentUserRoles.HasAnyFlags(AllowedRoles);
|
||||
@@ -67,23 +67,23 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// READ FULL RECORD (not just name and id)
|
||||
/// </summary>
|
||||
/// <param name="HttpContextItems"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasSelectRole(IDictionary<object, object> HttpContextItems, AyaType objectType)
|
||||
internal static bool HasSelectRole(IDictionary<object, object> HttpContextItems, AyaType aType)
|
||||
{
|
||||
AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems);
|
||||
return HasSelectRole(currentUserRoles, objectType);
|
||||
return HasSelectRole(currentUserRoles, aType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SELECT BY NAME
|
||||
/// </summary>
|
||||
/// <param name="currentUserRoles"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasSelectRole(AuthorizationRoles currentUserRoles, AyaType objectType)
|
||||
internal static bool HasSelectRole(AuthorizationRoles currentUserRoles, AyaType aType)
|
||||
{
|
||||
var RoleSet = BizRoles.GetRoleSet(objectType);
|
||||
var RoleSet = BizRoles.GetRoleSet(aType);
|
||||
if (RoleSet == null) return false;
|
||||
|
||||
//NOTE: this assumes that if you can change you can read
|
||||
@@ -104,24 +104,24 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// READ FULL RECORD (not just name and id)
|
||||
/// </summary>
|
||||
/// <param name="HttpContextItems"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasReadFullRole(IDictionary<object, object> HttpContextItems, AyaType objectType)
|
||||
internal static bool HasReadFullRole(IDictionary<object, object> HttpContextItems, AyaType aType)
|
||||
{
|
||||
AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems);
|
||||
return HasReadFullRole(currentUserRoles, objectType);
|
||||
return HasReadFullRole(currentUserRoles, aType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// READ FULL RECORD (not just name and id)
|
||||
/// </summary>
|
||||
/// <param name="currentUserRoles"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasReadFullRole(AuthorizationRoles currentUserRoles, AyaType objectType)
|
||||
internal static bool HasReadFullRole(AuthorizationRoles currentUserRoles, AyaType aType)
|
||||
{
|
||||
//NOTE: this assumes that if you can change you can read
|
||||
var RoleSet = BizRoles.GetRoleSet(objectType);
|
||||
var RoleSet = BizRoles.GetRoleSet(aType);
|
||||
if (RoleSet == null) return false;
|
||||
var AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
return currentUserRoles.HasAnyFlags(AllowedRoles);
|
||||
@@ -133,23 +133,23 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// CREATE
|
||||
/// </summary>
|
||||
/// <param name="HttpContextItems"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasCreateRole(IDictionary<object, object> HttpContextItems, AyaType objectType)
|
||||
internal static bool HasCreateRole(IDictionary<object, object> HttpContextItems, AyaType aType)
|
||||
{
|
||||
AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems);
|
||||
return HasCreateRole(currentUserRoles, objectType);
|
||||
return HasCreateRole(currentUserRoles, aType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CREATE
|
||||
/// </summary>
|
||||
/// <param name="currentUserRoles"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasCreateRole(AuthorizationRoles currentUserRoles, AyaType objectType)
|
||||
internal static bool HasCreateRole(AuthorizationRoles currentUserRoles, AyaType aType)
|
||||
{
|
||||
var RoleSet = BizRoles.GetRoleSet(objectType);
|
||||
var RoleSet = BizRoles.GetRoleSet(aType);
|
||||
if (RoleSet == null) return false;
|
||||
if (currentUserRoles.HasAnyFlags(RoleSet.Change))
|
||||
return true;
|
||||
@@ -161,13 +161,13 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// MODIFY
|
||||
/// </summary>
|
||||
/// <param name="HttpContextItems"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
|
||||
/// <returns></returns>
|
||||
internal static bool HasModifyRole(IDictionary<object, object> HttpContextItems, AyaType objectType)
|
||||
internal static bool HasModifyRole(IDictionary<object, object> HttpContextItems, AyaType aType)
|
||||
{
|
||||
AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems);
|
||||
return HasModifyRole(currentUserRoles, objectType);
|
||||
return HasModifyRole(currentUserRoles, aType);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,11 +175,11 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// MODIFY
|
||||
/// </summary>
|
||||
/// <param name="currentUserRoles"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasModifyRole(AuthorizationRoles currentUserRoles, AyaType objectType)
|
||||
internal static bool HasModifyRole(AuthorizationRoles currentUserRoles, AyaType aType)
|
||||
{
|
||||
var RoleSet = BizRoles.GetRoleSet(objectType);
|
||||
var RoleSet = BizRoles.GetRoleSet(aType);
|
||||
if (RoleSet == null) return false;
|
||||
if (currentUserRoles.HasAnyFlags(RoleSet.Change))
|
||||
return true;
|
||||
@@ -193,14 +193,14 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// DELETE
|
||||
/// </summary>
|
||||
/// <param name="HttpContextItems"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
//For now just going to treat as a modify, but for maximum flexibility keeping this as a separate method in case we change our minds in future
|
||||
internal static bool HasDeleteRole(IDictionary<object, object> HttpContextItems, AyaType objectType)
|
||||
internal static bool HasDeleteRole(IDictionary<object, object> HttpContextItems, AyaType aType)
|
||||
{
|
||||
AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems);
|
||||
long currentUserId = UserIdFromContext.Id(HttpContextItems);
|
||||
return HasDeleteRole(currentUserRoles, objectType);
|
||||
return HasDeleteRole(currentUserRoles, aType);
|
||||
}
|
||||
|
||||
|
||||
@@ -208,12 +208,12 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// DELETE
|
||||
/// </summary>
|
||||
/// <param name="currentUserRoles"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="aType"></param>
|
||||
/// <returns></returns>
|
||||
//For now just going to treat as a modify, but for maximum flexibility keeping this as a separate method in case we change our minds in future
|
||||
internal static bool HasDeleteRole(AuthorizationRoles currentUserRoles, AyaType objectType)
|
||||
internal static bool HasDeleteRole(AuthorizationRoles currentUserRoles, AyaType aType)
|
||||
{
|
||||
var RoleSet = BizRoles.GetRoleSet(objectType);
|
||||
var RoleSet = BizRoles.GetRoleSet(aType);
|
||||
if (RoleSet == null) return false;
|
||||
if (currentUserRoles.HasAnyFlags(RoleSet.Change))
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user