This commit is contained in:
@@ -39,6 +39,40 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// READ FULL RECORD (not just name and id)
|
||||
/// </summary>
|
||||
/// <param name="HttpContextItems"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasSelectRole(IDictionary<object, object> HttpContextItems, AyaType objectType)
|
||||
{
|
||||
AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems);
|
||||
return HasSelectRole(currentUserRoles, objectType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SELECT BY NAME
|
||||
/// </summary>
|
||||
/// <param name="currentUserRoles"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasSelectRole(AuthorizationRoles currentUserRoles, AyaType objectType)
|
||||
{
|
||||
//NOTE: this assumes that if you can change you can read
|
||||
if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).Change))
|
||||
return true;
|
||||
|
||||
if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).ReadFullRecord))
|
||||
return true;
|
||||
|
||||
if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).Select))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// READ FULL RECORD (not just name and id)
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user