//[TestMethod] public void LockRecursion_NoExtension() { var user = new LockRecursionUser(Id("E1"), entityId => new int[0]); var context = GetContextAndStartTheSystem(user); context.Security.HasPermission(Id("E1"), PermissionType.Open); }
private Context GetContextAndStartTheSystem(LockRecursionUser currentUser) { //SecuritySystem.Instance.SecurityActivityQueue._setCurrentExecutionState(new CompletionState()); //MemoryDataProvider.LastActivityId = 0; var securitySystem = Context.StartTheSystem(new MemoryDataProvider(DatabaseStorage.CreateEmpty()), new DefaultMessageProvider(new MessageSenderManager())); var context = new Context(currentUser, securitySystem); CreatePlayground(context); return(context); }
private Context GetContextAndStartTheSystem(LockRecursionUser currentUser) { SecurityActivityQueue._setCurrentExecutionState(new CompletionState()); MemoryDataProvider.LastActivityId = 0; Context.StartTheSystem(new MemoryDataProvider(DatabaseStorage.CreateEmpty()), new DefaultMessageProvider(), null); var context = new Context(currentUser); CreatePlayground(context); return(context); }
//[TestMethod] public void LockRecursion_NoExtension() { var user = new LockRecursionUser(Id("E1"), entityId => { // There is no extension. return(new int[0]); }); var context = GetContextAndStartTheSystem(user); context.Security.HasPermission(Id("E1"), PermissionType.FullControl); }
//[TestMethod] public void LockRecursion_AvoidWithElevation() { var user = new LockRecursionUser(Id("E1"), entityId => { // Simulate permission check in the getter of the PortalContext.ContextNode var elevatedContext = GetContext(new LockRecursionUser(-1, e => new int[0])); var aces = elevatedContext.Security.GetEffectiveEntries(Id("E1"), new[] { Id("U1") }); return(new int[0]); }); var context = GetContextAndStartTheSystem(user); context.Security.HasPermission(Id("E1"), PermissionType.Open); }
private Context GetContext(LockRecursionUser currentUser) { SecurityActivityQueue._setCurrentExecutionState(new CompletionState()); MemoryDataProvider.LastActivityId = 0; return(new Context(currentUser)); }