We have a class in our app called AccessMap that sort of looks like this:
using System;
using System.Collections.Generic;
using System.Reflection;
namespace OurApp.Core.Security
{
public class AccessMap
{
public List<string> Roles { get; set; }
public List<Guid> IdsOfTeamMemberAccounts { get; set; }
public List<Guid> IdsOfViewedAccounts { get; set; }
public AccessMap()
{
}
}
}
...only it has a lot more getsetters. 37 altogether. The getsetters are populated when the application spins up and then the AccessMap is referenced whenever relevant. If showing a list of "Team Member Accounts" and filtering down records shown by items permissioned to the user at hand, one may sanity check against the IdsOfTeamMemberAccounts in lieu of making a trip to the database. The AccessMap is cached in session.
The downside: lag when spinning up the app
The cure? I don't know. Perhaps we will populate portions of the AccessMap progressively as need be. Does anyone know a better way to approach this problem?
No comments:
Post a Comment