public void ShouldDenyNotAuthorized() { AclManager.DefaultProvider = new MemoryProvider(); AclManager.Allow("/travel", "read", "s.ros"); ShouldDenyNotAuthorizedByConfiguration(); }
public void ShouldNotifyOnAclRuleChange() { var router = new RouterProvider(); AclManager.DefaultProvider = router; router.Register("/travel", new MemoryProvider()); AclManager.RegisterForRuleChange("/travel", s => TestContext.WriteLine("'{0}' has changed", s)); AclManager.AclChanged += new Action <string>(s => TestContext.WriteLine("* '{0}' has changed", s)); AclManager.Allow("/", "read", "*"); AclManager.Deny("/travel", "read", "s.ros"); AclManager.Deny("/travel/asshole", "read", "s.ros"); }
public void Bug() { AclManager.DefaultProvider = new MemoryProvider(); AclManager.Allow("/", "read", "*"); AclManager.Deny("/travel", "read", "s.ros"); Assert.IsFalse(AclManager.IsAllowed("/travel", "read", "s.ros")); Assert.IsFalse(AclManager.IsAllowed("/travel/asshole", "read", "s.ros")); Assert.IsTrue(AclManager.IsAllowed("/", "read", "s.ros")); Assert.IsTrue(AclManager.IsAllowed("/", "read", "peter")); Assert.IsTrue(AclManager.IsAllowed("/travel", "read", "peter")); Assert.IsTrue(AclManager.IsAllowed("/travel/asshole", "read", "peter")); }
public void SqlAclShouldWork() { AclManager.DefaultProvider = new SqlAclProvider(); AclManager.Allow("/", "read", "*"); AclManager.Deny("/travel", "read", "s.ros"); Assert.IsFalse(AclManager.IsAllowed("/travel", "read", "s.ros")); Assert.IsFalse(AclManager.IsAllowed("/travel/asshole", "read", "s.ros")); Assert.IsTrue(AclManager.IsAllowed("/", "read", "s.ros")); Assert.IsTrue(AclManager.IsAllowed("/", "read", "peter")); Assert.IsTrue(AclManager.IsAllowed("/travel", "read", "peter")); Assert.IsTrue(AclManager.IsAllowed("/travel/asshole", "read", "peter")); }
public void ShouldHandleStarVerb() { RouterProvider router = new RouterProvider(); AclManager.DefaultProvider = router; IAclProvider urls = new MemoryProvider(); router.Register("/Widget/Rss/Urls", urls); IAclProvider actions = new MemoryProvider(); router.Register("/Widget", actions); AclManager.Allow("/Widget", "*", "*"); AclManager.Deny("/Widget/Rss/Urls", "access", "~/Widgets/ClientRss/ClientRssWidget.ascx"); AclManager.Allow("/Widget/Rss/Urls/fr/happly", "Access", "~/Widgets/ClientRss/ClientRssWidget.ascx"); AclManager.Deny("/Widget/Rss/Urls/fr/happly/knowledgebank", "access", "~/Widgets/ClientRss/ClientRssWidget.ascx"); Assert.IsFalse(AclManager.IsAllowed("/Widget/Rss/Urls", "access", "~/Widgets/ClientRss/ClientRssWidget.ascx")); Assert.IsFalse(AclManager.IsAllowed("/Widget/Rss/Urls/fr/happly/knowledgebank", "access", "~/Widgets/ClientRss/ClientRssWidget.ascx")); Assert.IsTrue(AclManager.IsAllowed("/Widget/Rss/Urls/fr/happly/knoledgebank", "access", "~/Widgets/ClientRss/ClientRssWidget.ascx")); Assert.IsTrue(AclManager.IsAllowed("/Widget", "read", "~/Widgets/ClientRss/ClientRssWidget.ascx")); Assert.IsTrue(AclManager.IsAllowed("/Widget/Rss/Urls/fr/happly/knowledgebank", "read", "~/Widgets/ClientRss/ClientRssWidget.ascx")); }