aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-07-30 19:34:55 +0100
committerJustin Clark-Casey (justincc)2010-07-30 19:34:55 +0100
commitf393e10ea48804d7de4ed8f534bf425660b2c441 (patch)
treec43a7dbc5e004ec84ceb30d8d07441a1e7c67ece /OpenSim/Framework/Tests
parentconvert attachments module from old region module style to new (diff)
downloadopensim-SC_OLD-f393e10ea48804d7de4ed8f534bf425660b2c441.zip
opensim-SC_OLD-f393e10ea48804d7de4ed8f534bf425660b2c441.tar.gz
opensim-SC_OLD-f393e10ea48804d7de4ed8f534bf425660b2c441.tar.bz2
opensim-SC_OLD-f393e10ea48804d7de4ed8f534bf425660b2c441.tar.xz
remove unused ACL class
Diffstat (limited to 'OpenSim/Framework/Tests')
-rw-r--r--OpenSim/Framework/Tests/ACLTest.cs125
1 files changed, 0 insertions, 125 deletions
diff --git a/OpenSim/Framework/Tests/ACLTest.cs b/OpenSim/Framework/Tests/ACLTest.cs
deleted file mode 100644
index 06e860e..0000000
--- a/OpenSim/Framework/Tests/ACLTest.cs
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using NUnit.Framework;
30using System.Collections.Generic;
31
32
33namespace OpenSim.Framework.Tests
34{
35 [TestFixture]
36 public class ACLTest
37 {
38 #region Tests
39
40 /// <summary>
41 /// ACL Test class
42 /// </summary>
43 [Test]
44 public void ACLTest01()
45 {
46 ACL acl = new ACL();
47
48 Role Guests = new Role("Guests");
49 acl.AddRole(Guests);
50
51 Role[] parents = new Role[1];
52 parents[0] = Guests;
53
54 Role JoeGuest = new Role("JoeGuest", parents);
55 acl.AddRole(JoeGuest);
56
57 Resource CanBuild = new Resource("CanBuild");
58 acl.AddResource(CanBuild);
59
60
61 acl.GrantPermission("Guests", "CanBuild");
62
63 Permission perm = acl.HasPermission("JoeGuest", "CanBuild");
64 Assert.That(perm == Permission.Allow, "JoeGuest should have permission to build");
65 perm = Permission.None;
66 try
67 {
68 perm = acl.HasPermission("unknownGuest", "CanBuild");
69
70 }
71 catch (KeyNotFoundException)
72 {
73
74
75 }
76 catch (Exception)
77 {
78 Assert.That(false,"Exception thrown should have been KeyNotFoundException");
79 }
80 Assert.That(perm == Permission.None,"Permission None should be set because exception should have been thrown");
81
82 }
83
84 [Test]
85 public void KnownButPermissionDenyAndPermissionNoneUserTest()
86 {
87 ACL acl = new ACL();
88
89 Role Guests = new Role("Guests");
90 acl.AddRole(Guests);
91 Role Administrators = new Role("Administrators");
92 acl.AddRole(Administrators);
93 Role[] Guestparents = new Role[1];
94 Role[] Adminparents = new Role[1];
95
96 Guestparents[0] = Guests;
97 Adminparents[0] = Administrators;
98
99 Role JoeGuest = new Role("JoeGuest", Guestparents);
100 acl.AddRole(JoeGuest);
101
102 Resource CanBuild = new Resource("CanBuild");
103 acl.AddResource(CanBuild);
104
105 Resource CanScript = new Resource("CanScript");
106 acl.AddResource(CanScript);
107
108 Resource CanRestart = new Resource("CanRestart");
109 acl.AddResource(CanRestart);
110
111 acl.GrantPermission("Guests", "CanBuild");
112 acl.DenyPermission("Guests", "CanRestart");
113
114 acl.GrantPermission("Administrators", "CanScript");
115
116 acl.GrantPermission("Administrators", "CanRestart");
117 Permission setPermission = acl.HasPermission("JoeGuest", "CanRestart");
118 Assert.That(setPermission == Permission.Deny, "Guests Should not be able to restart");
119 Assert.That(acl.HasPermission("JoeGuest", "CanScript") == Permission.None,
120 "No Explicit Permissions set so should be Permission.None");
121 }
122
123 #endregion
124 }
125}