aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/PermissionManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/PermissionManager.cs')
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs36
1 files changed, 22 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 3e481e8..110a130 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -19,21 +19,17 @@ namespace OpenSim.Region.Environment
19 // disable in any production environment 19 // disable in any production environment
20 // TODO: Change this to false when permissions are a desired default 20 // TODO: Change this to false when permissions are a desired default
21 // TODO: Move to configuration option. 21 // TODO: Move to configuration option.
22 private bool bypassPermissions = true; 22 private bool m_bypassPermissions = true;
23 23 public bool BypassPermissions
24 public PermissionManager(Scene scene)
25 { 24 {
26 m_scene = scene; 25 get { return m_bypassPermissions; }
26 set { m_bypassPermissions = value; }
27 } 27 }
28 28
29 public void DisablePermissions()
30 {
31 bypassPermissions = true;
32 }
33 29
34 public void EnablePermissions() 30 public PermissionManager(Scene scene)
35 { 31 {
36 bypassPermissions = false; 32 m_scene = scene;
37 } 33 }
38 34
39 protected virtual void SendPermissionError(LLUUID user, string reason) 35 protected virtual void SendPermissionError(LLUUID user, string reason)
@@ -43,16 +39,20 @@ namespace OpenSim.Region.Environment
43 39
44 protected virtual bool IsAdministrator(LLUUID user) 40 protected virtual bool IsAdministrator(LLUUID user)
45 { 41 {
46 if (bypassPermissions) 42 if (m_bypassPermissions)
47 return bypassPermissions; 43 {
44 return true;
45 }
48 46
49 return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; 47 return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
50 } 48 }
51 49
52 protected virtual bool IsEstateManager(LLUUID user) 50 protected virtual bool IsEstateManager(LLUUID user)
53 { 51 {
54 if (bypassPermissions) 52 if (m_bypassPermissions)
55 return bypassPermissions; 53 {
54 return true;
55 }
56 56
57 return false; 57 return false;
58 } 58 }
@@ -74,14 +74,22 @@ namespace OpenSim.Region.Environment
74 string reason = "Insufficient permission"; 74 string reason = "Insufficient permission";
75 75
76 if (IsAdministrator(user)) 76 if (IsAdministrator(user))
77 {
77 permission = true; 78 permission = true;
79 }
78 else 80 else
81 {
79 reason = "Not an administrator"; 82 reason = "Not an administrator";
83 }
80 84
81 if (GenericParcelPermission(user, position)) 85 if (GenericParcelPermission(user, position))
86 {
82 permission = true; 87 permission = true;
88 }
83 else 89 else
90 {
84 reason = "Not the parcel owner"; 91 reason = "Not the parcel owner";
92 }
85 93
86 if (!permission) 94 if (!permission)
87 SendPermissionError(user, reason); 95 SendPermissionError(user, reason);