aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs138
1 files changed, 99 insertions, 39 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index 7135a21..ea894ab 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -81,10 +81,17 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
81 private bool m_ParcelOwnerIsGod = false; 81 private bool m_ParcelOwnerIsGod = false;
82 82
83 /// <value> 83 /// <value>
84 /// The set of users that are allowed to create scripts. 84 /// The set of users that are allowed to create scripts. This is only active if permissions are not being
85 /// bypassed. This overrides normal permissions.
85 /// </value> 86 /// </value>
86 private UserSet m_allowedScriptCreators = UserSet.All; 87 private UserSet m_allowedScriptCreators = UserSet.All;
87 88
89 /// <value>
90 /// The set of users that are allowed to view (and in Second Life, edit) scripts. This is only active if
91 /// permissions are not being bypassed. This overrides normal permissions.-
92 /// </value>
93 //private UserSet m_allowedScriptViewers = UserSet.All;
94
88 #endregion 95 #endregion
89 96
90 #region ICommandableModule Members 97 #region ICommandableModule Members
@@ -162,26 +169,8 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
162 m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); 169 m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true);
163 m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); 170 m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true);
164 171
165 string allowedScriptCreators = myConfig.GetString("allowed_script_creators", UserSet.All.ToString()); 172 m_allowedScriptCreators
166 173 = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators);
167 // Temporary measure to allow 'gods' to be specified in config for consistency's sake. In the long term
168 // this should disappear.
169 if ("gods" == allowedScriptCreators.ToLower())
170 allowedScriptCreators = UserSet.Administrators.ToString();
171
172 // Doing it this was so that we can do a case insensitive conversion
173 try
174 {
175 m_allowedScriptCreators = (UserSet)Enum.Parse(typeof(UserSet), allowedScriptCreators, true);
176 }
177 catch
178 {
179 m_log.ErrorFormat(
180 "[PERMISSIONS]: {0} is not a valid allowed_script_creators value, setting to {1}",
181 allowedScriptCreators, m_allowedScriptCreators);
182 }
183
184 m_log.DebugFormat("[PERMISSIONS]: m_allowedScriptCreators {0}", m_allowedScriptCreators);
185 174
186 if (m_bypassPermissions) 175 if (m_bypassPermissions)
187 m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks"); 176 m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks");
@@ -199,9 +188,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
199 m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED 188 m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED
200 m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED 189 m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED
201 m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED 190 m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED
202 m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED 191 m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED
203 m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED
204 m_scene.ExternalChecks.addCheckEditNotecard(CanEditNotecard); //NOT YET IMPLEMENTED
205 m_scene.ExternalChecks.addCheckInstantMessage(CanInstantMessage); //FULLY IMPLEMENTED 192 m_scene.ExternalChecks.addCheckInstantMessage(CanInstantMessage); //FULLY IMPLEMENTED
206 m_scene.ExternalChecks.addCheckInventoryTransfer(CanInventoryTransfer); //NOT YET IMPLEMENTED 193 m_scene.ExternalChecks.addCheckInventoryTransfer(CanInventoryTransfer); //NOT YET IMPLEMENTED
207 m_scene.ExternalChecks.addCheckIssueEstateCommand(CanIssueEstateCommand); //FULLY IMPLEMENTED 194 m_scene.ExternalChecks.addCheckIssueEstateCommand(CanIssueEstateCommand); //FULLY IMPLEMENTED
@@ -215,19 +202,25 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
215 m_scene.ExternalChecks.addCheckTakeObject(CanTakeObject); //FULLY IMPLEMENTED 202 m_scene.ExternalChecks.addCheckTakeObject(CanTakeObject); //FULLY IMPLEMENTED
216 m_scene.ExternalChecks.addCheckTakeCopyObject(CanTakeCopyObject); //FULLY IMPLEMENTED 203 m_scene.ExternalChecks.addCheckTakeCopyObject(CanTakeCopyObject); //FULLY IMPLEMENTED
217 m_scene.ExternalChecks.addCheckTerraformLand(CanTerraformLand); //FULL IMPLEMENTED (POINT ONLY!!! NOT AREA!!!) 204 m_scene.ExternalChecks.addCheckTerraformLand(CanTerraformLand); //FULL IMPLEMENTED (POINT ONLY!!! NOT AREA!!!)
218 m_scene.ExternalChecks.addCheckViewScript(CanViewScript); //NOT YET IMPLEMENTED
219 m_scene.ExternalChecks.addCheckViewNotecard(CanViewNotecard); //NOT YET IMPLEMENTED
220 m_scene.ExternalChecks.addCheckCanLinkObject(CanLinkObject); //NOT YET IMPLEMENTED 205 m_scene.ExternalChecks.addCheckCanLinkObject(CanLinkObject); //NOT YET IMPLEMENTED
221 m_scene.ExternalChecks.addCheckCanDelinkObject(CanDelinkObject); //NOT YET IMPLEMENTED 206 m_scene.ExternalChecks.addCheckCanDelinkObject(CanDelinkObject); //NOT YET IMPLEMENTED
222 m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //NOT YET IMPLEMENTED 207 m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //NOT YET IMPLEMENTED
208
209 m_scene.ExternalChecks.addCheckViewNotecard(CanViewNotecard); //NOT YET IMPLEMENTED
210 m_scene.ExternalChecks.addCheckViewScript(CanViewScript); //NOT YET IMPLEMENTED
211 m_scene.ExternalChecks.addCheckEditNotecard(CanEditNotecard); //NOT YET IMPLEMENTED
212 m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED
213
223 m_scene.ExternalChecks.addCheckCanCreateObjectInventory(CanCreateObjectInventory); //NOT IMPLEMENTED HERE 214 m_scene.ExternalChecks.addCheckCanCreateObjectInventory(CanCreateObjectInventory); //NOT IMPLEMENTED HERE
224 m_scene.ExternalChecks.addCheckEditObjectInventory(CanEditObjectInventory);//MAYBE FULLY IMPLEMENTED 215 m_scene.ExternalChecks.addCheckEditObjectInventory(CanEditObjectInventory);//MAYBE FULLY IMPLEMENTED
225 m_scene.ExternalChecks.addCheckCanCopyObjectInventory(CanCopyObjectInventory); //NOT YET IMPLEMENTED 216 m_scene.ExternalChecks.addCheckCanCopyObjectInventory(CanCopyObjectInventory); //NOT YET IMPLEMENTED
226 m_scene.ExternalChecks.addCheckCanDeleteObjectInventory(CanDeleteObjectInventory); //NOT YET IMPLEMENTED 217 m_scene.ExternalChecks.addCheckCanDeleteObjectInventory(CanDeleteObjectInventory); //NOT YET IMPLEMENTED
218
227 m_scene.ExternalChecks.addCheckCanCreateUserInventory(CanCreateUserInventory); //NOT YET IMPLEMENTED 219 m_scene.ExternalChecks.addCheckCanCreateUserInventory(CanCreateUserInventory); //NOT YET IMPLEMENTED
228 m_scene.ExternalChecks.addCheckCanCopyUserInventory(CanCopyUserInventory); //NOT YET IMPLEMENTED 220 m_scene.ExternalChecks.addCheckCanCopyUserInventory(CanCopyUserInventory); //NOT YET IMPLEMENTED
229 m_scene.ExternalChecks.addCheckCanEditUserInventory(CanEditUserInventory); //NOT YET IMPLEMENTED 221 m_scene.ExternalChecks.addCheckCanEditUserInventory(CanEditUserInventory); //NOT YET IMPLEMENTED
230 m_scene.ExternalChecks.addCheckCanDeleteUserInventory(CanDeleteUserInventory); //NOT YET IMPLEMENTED 222 m_scene.ExternalChecks.addCheckCanDeleteUserInventory(CanDeleteUserInventory); //NOT YET IMPLEMENTED
223
231 m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED 224 m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED
232 225
233 //Register Debug Commands 226 //Register Debug Commands
@@ -272,11 +265,47 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
272 { 265 {
273 m_scene.EventManager.TriggerPermissionError(user, reason); 266 m_scene.EventManager.TriggerPermissionError(user, reason);
274 } 267 }
268
275 protected void DebugPermissionInformation(string permissionCalled) 269 protected void DebugPermissionInformation(string permissionCalled)
276 { 270 {
277 if (m_debugPermissions) 271 if (m_debugPermissions)
278 m_log.Debug("[PERMISSIONS]: " + permissionCalled + " was called from " + m_scene.RegionInfo.RegionName); 272 m_log.Debug("[PERMISSIONS]: " + permissionCalled + " was called from " + m_scene.RegionInfo.RegionName);
279 } 273 }
274
275 /// <summary>
276 /// Parse a user set configuration setting
277 /// </summary>
278 /// <param name="config"></param>
279 /// <param name="settingName"></param>
280 /// <param name="defaultValue">The default value for this attribute</param>
281 /// <returns>The parsed value</returns>
282 private static UserSet ParseUserSetConfigSetting(IConfig config, string settingName, UserSet defaultValue)
283 {
284 UserSet userSet = defaultValue;
285
286 string rawSetting = config.GetString(settingName, defaultValue.ToString());
287
288 // Temporary measure to allow 'gods' to be specified in config for consistency's sake. In the long term
289 // this should disappear.
290 if ("gods" == rawSetting.ToLower())
291 rawSetting = UserSet.Administrators.ToString();
292
293 // Doing it this was so that we can do a case insensitive conversion
294 try
295 {
296 userSet = (UserSet)Enum.Parse(typeof(UserSet), rawSetting, true);
297 }
298 catch
299 {
300 m_log.ErrorFormat(
301 "[PERMISSIONS]: {0} is not a valid {1} value, setting to {2}",
302 rawSetting, settingName, userSet);
303 }
304
305 //m_log.DebugFormat("[PERMISSIONS]: {0} {1}", settingName, userSet);
306
307 return userSet;
308 }
280 309
281 /// <summary> 310 /// <summary>
282 /// Is the given user an administrator (in other words, a god)? 311 /// Is the given user an administrator (in other words, a god)?
@@ -683,6 +712,14 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
683 return GenericParcelPermission(user, parcel); 712 return GenericParcelPermission(user, parcel);
684 } 713 }
685 714
715 /// <summary>
716 /// Check whether the specified user can edit the given script
717 /// </summary>
718 /// <param name="script"></param>
719 /// <param name="objectID"></param>
720 /// <param name="user"></param>
721 /// <param name="scene"></param>
722 /// <returns></returns>
686 private bool CanEditScript(UUID script, UUID objectID, UUID user, Scene scene) 723 private bool CanEditScript(UUID script, UUID objectID, UUID user, Scene scene)
687 { 724 {
688 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 725 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -694,6 +731,14 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
694 return CanViewScript(script, objectID, user, scene); 731 return CanViewScript(script, objectID, user, scene);
695 } 732 }
696 733
734 /// <summary>
735 /// Check whether the specified user can edit the given notecard
736 /// </summary>
737 /// <param name="notecard"></param>
738 /// <param name="objectID"></param>
739 /// <param name="user"></param>
740 /// <param name="scene"></param>
741 /// <returns></returns>
697 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) 742 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
698 { 743 {
699 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 744 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -852,7 +897,6 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
852 // Locked 897 // Locked
853 if ((task.RootPart.OwnerMask & PERM_LOCKED) == 0) 898 if ((task.RootPart.OwnerMask & PERM_LOCKED) == 0)
854 permission = false; 899 permission = false;
855
856 } 900 }
857 else 901 else
858 { 902 {
@@ -1073,6 +1117,14 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1073 return false; 1117 return false;
1074 } 1118 }
1075 1119
1120 /// <summary>
1121 /// Check whether the specified user can view the given script
1122 /// </summary>
1123 /// <param name="script"></param>
1124 /// <param name="objectID"></param>
1125 /// <param name="user"></param>
1126 /// <param name="scene"></param>
1127 /// <returns></returns>
1076 private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene) 1128 private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene)
1077 { 1129 {
1078 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1130 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1155,6 +1207,14 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1155 return true; 1207 return true;
1156 } 1208 }
1157 1209
1210 /// <summary>
1211 /// Check whether the specified user can view the given notecard
1212 /// </summary>
1213 /// <param name="script"></param>
1214 /// <param name="objectID"></param>
1215 /// <param name="user"></param>
1216 /// <param name="scene"></param>
1217 /// <returns></returns>
1158 private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) 1218 private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
1159 { 1219 {
1160 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1220 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1224,7 +1284,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1224 1284
1225 #endregion 1285 #endregion
1226 1286
1227 public bool CanLinkObject(UUID userID, UUID objectID) 1287 private bool CanLinkObject(UUID userID, UUID objectID)
1228 { 1288 {
1229 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1289 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1230 if (m_bypassPermissions) return m_bypassPermissionsValue; 1290 if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1232,7 +1292,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1232 return true; 1292 return true;
1233 } 1293 }
1234 1294
1235 public bool CanDelinkObject(UUID userID, UUID objectID) 1295 private bool CanDelinkObject(UUID userID, UUID objectID)
1236 { 1296 {
1237 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1297 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1238 if (m_bypassPermissions) return m_bypassPermissionsValue; 1298 if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1240,7 +1300,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1240 return true; 1300 return true;
1241 } 1301 }
1242 1302
1243 public bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene) 1303 private bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene)
1244 { 1304 {
1245 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1305 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1246 if (m_bypassPermissions) return m_bypassPermissionsValue; 1306 if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1248,7 +1308,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1248 return true; 1308 return true;
1249 } 1309 }
1250 1310
1251 public bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID) 1311 private bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID)
1252 { 1312 {
1253 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1313 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1254 if (m_bypassPermissions) return m_bypassPermissionsValue; 1314 if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1256,7 +1316,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1256 return true; 1316 return true;
1257 } 1317 }
1258 1318
1259 public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) 1319 private bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
1260 { 1320 {
1261 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1321 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1262 if (m_bypassPermissions) return m_bypassPermissionsValue; 1322 if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1272,7 +1332,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1272 /// <param name="objectID"></param> 1332 /// <param name="objectID"></param>
1273 /// <param name="userID"></param> 1333 /// <param name="userID"></param>
1274 /// <returns></returns> 1334 /// <returns></returns>
1275 public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID) 1335 private bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID)
1276 { 1336 {
1277 m_log.Debug("[PERMISSIONS]: CanCreateObjectInventory called"); 1337 m_log.Debug("[PERMISSIONS]: CanCreateObjectInventory called");
1278 1338
@@ -1292,7 +1352,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1292 /// <param name="invType"></param> 1352 /// <param name="invType"></param>
1293 /// <param name="userID"></param> 1353 /// <param name="userID"></param>
1294 /// <returns></returns> 1354 /// <returns></returns>
1295 public bool CanCreateUserInventory(int invType, UUID userID) 1355 private bool CanCreateUserInventory(int invType, UUID userID)
1296 { 1356 {
1297 m_log.Debug("[PERMISSIONS]: CanCreateAvatarInventory called"); 1357 m_log.Debug("[PERMISSIONS]: CanCreateAvatarInventory called");
1298 1358
@@ -1312,7 +1372,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1312 /// <param name="itemID"></param> 1372 /// <param name="itemID"></param>
1313 /// <param name="userID"></param> 1373 /// <param name="userID"></param>
1314 /// <returns></returns> 1374 /// <returns></returns>
1315 public bool CanCopyUserInventory(UUID itemID, UUID userID) 1375 private bool CanCopyUserInventory(UUID itemID, UUID userID)
1316 { 1376 {
1317 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1377 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1318 if (m_bypassPermissions) return m_bypassPermissionsValue; 1378 if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1326,7 +1386,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1326 /// <param name="itemID"></param> 1386 /// <param name="itemID"></param>
1327 /// <param name="userID"></param> 1387 /// <param name="userID"></param>
1328 /// <returns></returns> 1388 /// <returns></returns>
1329 public bool CanEditUserInventory(UUID itemID, UUID userID) 1389 private bool CanEditUserInventory(UUID itemID, UUID userID)
1330 { 1390 {
1331 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1391 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1332 if (m_bypassPermissions) return m_bypassPermissionsValue; 1392 if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1340,7 +1400,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1340 /// <param name="itemID"></param> 1400 /// <param name="itemID"></param>
1341 /// <param name="userID"></param> 1401 /// <param name="userID"></param>
1342 /// <returns></returns> 1402 /// <returns></returns>
1343 public bool CanDeleteUserInventory(UUID itemID, UUID userID) 1403 private bool CanDeleteUserInventory(UUID itemID, UUID userID)
1344 { 1404 {
1345 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1405 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1346 if (m_bypassPermissions) return m_bypassPermissionsValue; 1406 if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1348,7 +1408,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1348 return true; 1408 return true;
1349 } 1409 }
1350 1410
1351 public bool CanTeleport(UUID userID) 1411 private bool CanTeleport(UUID userID)
1352 { 1412 {
1353 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1413 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1354 if (m_bypassPermissions) return m_bypassPermissionsValue; 1414 if (m_bypassPermissions) return m_bypassPermissionsValue;