29 using System.Collections.Generic;
31 using System.Reflection;
35 using OpenSim.Framework;
37 using OpenSim.Region.Framework.Interfaces;
38 using OpenSim.Region.Framework.Scenes;
39 using OpenSim.Services.Interfaces;
46 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"DefaultPermissionsModule")]
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 if (m_libraryRootFolder != null)
60 return m_libraryRootFolder;
65 m_libraryRootFolder = lib.LibraryRootFolder;
67 return m_libraryRootFolder;
75 private uint PERM_COPY = (uint)32768;
77 private uint PERM_MOVE = (uint)524288;
78 private uint PERM_TRANS = (uint)8192;
79 private uint PERM_LOCKED = (uint)540672;
92 #region Bypass Permissions / Debug Permissions Stuff
95 private bool m_bypassPermissions =
true;
96 private bool m_bypassPermissionsValue =
true;
97 private bool m_propagatePermissions =
false;
98 private bool m_debugPermissions =
false;
99 private bool m_allowGridGods =
false;
100 private bool m_RegionOwnerIsGod =
false;
101 private bool m_RegionManagerIsGod =
false;
102 private bool m_ParcelOwnerIsGod =
false;
104 private bool m_SimpleBuildPermissions =
false;
110 private UserSet m_allowedScriptCreators = UserSet.All;
116 private UserSet m_allowedScriptEditors = UserSet.All;
118 private Dictionary<string, bool> GrantLSL =
new Dictionary<string, bool>();
119 private Dictionary<string, bool> GrantCS =
new Dictionary<string, bool>();
120 private Dictionary<string, bool> GrantVB =
new Dictionary<string, bool>();
121 private Dictionary<string, bool> GrantJS =
new Dictionary<string, bool>();
122 private Dictionary<string, bool> GrantYP =
new Dictionary<string, bool>();
129 if (m_friendsModule == null)
130 m_friendsModule = m_scene.RequestModuleInterface<
IFriendsModule>();
131 return m_friendsModule;
139 if (m_groupsModule == null)
140 m_groupsModule = m_scene.RequestModuleInterface<
IGroupsModule>();
141 return m_groupsModule;
150 if (m_moapModule == null)
151 m_moapModule = m_scene.RequestModuleInterface<
IMoapModule>();
157 #region INonSharedRegionModule Members
161 string permissionModules = Util.GetConfigVarFromSections<
string>(config,
"permissionmodules",
162 new string[] {
"Startup",
"Permissions" },
"DefaultPermissionsModule");
164 List<string> modules =
new List<string>(permissionModules.Split(
',').Select(m => m.Trim()));
166 if (!modules.Contains(
"DefaultPermissionsModule"))
171 m_allowGridGods = Util.GetConfigVarFromSections<
bool>(config,
"allow_grid_gods",
172 new string[] {
"Startup",
"Permissions" },
false);
173 m_bypassPermissions = !Util.GetConfigVarFromSections<
bool>(config,
"serverside_object_permissions",
174 new string[] {
"Startup",
"Permissions" },
true);
175 m_propagatePermissions = Util.GetConfigVarFromSections<
bool>(config,
"propagate_permissions",
176 new string[] {
"Startup",
"Permissions" },
true);
177 m_RegionOwnerIsGod = Util.GetConfigVarFromSections<
bool>(config,
"region_owner_is_god",
178 new string[] {
"Startup",
"Permissions" },
true);
179 m_RegionManagerIsGod = Util.GetConfigVarFromSections<
bool>(config,
"region_manager_is_god",
180 new string[] {
"Startup",
"Permissions" },
false);
181 m_ParcelOwnerIsGod = Util.GetConfigVarFromSections<
bool>(config,
"parcel_owner_is_god",
182 new string[] {
"Startup",
"Permissions" },
false);
184 m_SimpleBuildPermissions = Util.GetConfigVarFromSections<
bool>(config,
"simple_build_permissions",
185 new string[] {
"Startup",
"Permissions" },
false);
187 m_allowedScriptCreators
188 = ParseUserSetConfigSetting(config,
"allowed_script_creators", m_allowedScriptCreators);
189 m_allowedScriptEditors
190 = ParseUserSetConfigSetting(config,
"allowed_script_editors", m_allowedScriptEditors);
192 if (m_bypassPermissions)
193 m_log.Info(
"[PERMISSIONS]: serverside_object_permissions = false in ini file so disabling all region service permission checks");
195 m_log.Debug(
"[PERMISSIONS]: Enabling all region service permission checks");
197 string grant = Util.GetConfigVarFromSections<
string>(config,
"GrantLSL",
198 new string[] {
"Startup",
"Permissions" }, string.Empty);
199 if (grant.Length > 0)
201 foreach (
string uuidl
in grant.Split(
','))
203 string uuid = uuidl.Trim(
" \t".ToCharArray());
204 GrantLSL.Add(uuid,
true);
208 grant = Util.GetConfigVarFromSections<
string>(config,
"GrantCS",
209 new string[] {
"Startup",
"Permissions" }, string.Empty);
210 if (grant.Length > 0)
212 foreach (
string uuidl
in grant.Split(
','))
214 string uuid = uuidl.Trim(
" \t".ToCharArray());
215 GrantCS.Add(uuid,
true);
219 grant = Util.GetConfigVarFromSections<
string>(config,
"GrantVB",
220 new string[] {
"Startup",
"Permissions" }, string.Empty);
221 if (grant.Length > 0)
223 foreach (
string uuidl
in grant.Split(
','))
225 string uuid = uuidl.Trim(
" \t".ToCharArray());
226 GrantVB.Add(uuid,
true);
230 grant = Util.GetConfigVarFromSections<
string>(config,
"GrantJS",
231 new string[] {
"Startup",
"Permissions" }, string.Empty);
232 if (grant.Length > 0)
234 foreach (
string uuidl
in grant.Split(
','))
236 string uuid = uuidl.Trim(
" \t".ToCharArray());
237 GrantJS.Add(uuid,
true);
241 grant = Util.GetConfigVarFromSections<
string>(config,
"GrantYP",
242 new string[] {
"Startup",
"Permissions" }, string.Empty);
243 if (grant.Length > 0)
245 foreach (
string uuidl
in grant.Split(
','))
247 string uuid = uuidl.Trim(
" \t".ToCharArray());
248 GrantYP.Add(uuid,
true);
263 m_scene.Permissions.OnBypassPermissions += BypassPermissions;
264 m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions;
265 m_scene.Permissions.OnPropagatePermissions += PropagatePermissions;
266 m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags;
267 m_scene.Permissions.OnAbandonParcel += CanAbandonParcel;
268 m_scene.Permissions.OnReclaimParcel += CanReclaimParcel;
269 m_scene.Permissions.OnDeedParcel += CanDeedParcel;
270 m_scene.Permissions.OnDeedObject += CanDeedObject;
271 m_scene.Permissions.OnIsGod += IsGod;
272 m_scene.Permissions.OnIsGridGod += IsGridGod;
273 m_scene.Permissions.OnIsAdministrator += IsAdministrator;
274 m_scene.Permissions.OnIsEstateManager += IsEstateManager;
275 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
276 m_scene.Permissions.OnDeleteObject += CanDeleteObject;
277 m_scene.Permissions.OnEditObject += CanEditObject;
278 m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties;
279 m_scene.Permissions.OnInstantMessage += CanInstantMessage;
280 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer;
281 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand;
282 m_scene.Permissions.OnMoveObject += CanMoveObject;
283 m_scene.Permissions.OnObjectEntry += CanObjectEntry;
284 m_scene.Permissions.OnReturnObjects += CanReturnObjects;
285 m_scene.Permissions.OnRezObject += CanRezObject;
286 m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand;
287 m_scene.Permissions.OnRunScript += CanRunScript;
288 m_scene.Permissions.OnCompileScript += CanCompileScript;
289 m_scene.Permissions.OnSellParcel += CanSellParcel;
290 m_scene.Permissions.OnTakeObject += CanTakeObject;
291 m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject;
292 m_scene.Permissions.OnTerraformLand += CanTerraformLand;
293 m_scene.Permissions.OnLinkObject += CanLinkObject;
294 m_scene.Permissions.OnDelinkObject += CanDelinkObject;
295 m_scene.Permissions.OnBuyLand += CanBuyLand;
297 m_scene.Permissions.OnViewNotecard += CanViewNotecard;
298 m_scene.Permissions.OnViewScript += CanViewScript;
299 m_scene.Permissions.OnEditNotecard += CanEditNotecard;
300 m_scene.Permissions.OnEditScript += CanEditScript;
302 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory;
303 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;
304 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory;
305 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory;
306 m_scene.Permissions.OnResetScript += CanResetScript;
308 m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory;
309 m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory;
310 m_scene.Permissions.OnEditUserInventory += CanEditUserInventory;
311 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory;
313 m_scene.Permissions.OnTeleport += CanTeleport;
315 m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
316 m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
318 m_scene.AddCommand(
"Users",
this,
"bypass permissions",
319 "bypass permissions <true / false>",
320 "Bypass permission checks",
321 HandleBypassPermissions);
323 m_scene.AddCommand(
"Users",
this,
"force permissions",
324 "force permissions <true / false>",
325 "Force permissions on or off",
326 HandleForcePermissions);
328 m_scene.AddCommand(
"Debug",
this,
"debug permissions",
329 "debug permissions <true / false>",
330 "Turn on permissions debugging",
331 HandleDebugPermissions);
353 get {
return "DefaultPermissionsModule"; }
356 public Type ReplaceableInterface
363 #region Console command handlers
367 if (m_scene.ConsoleScene() != null &&
368 m_scene.ConsoleScene() != m_scene)
377 if (!
bool.TryParse(args[2], out val))
380 m_bypassPermissions = val;
383 "[PERMISSIONS]: Set permissions bypass to {0} for {1}",
384 m_bypassPermissions, m_scene.RegionInfo.RegionName);
390 if (m_scene.ConsoleScene() != null &&
391 m_scene.ConsoleScene() != m_scene)
396 if (!m_bypassPermissions)
398 m_log.Error(
"[PERMISSIONS] Permissions can't be forced unless they are bypassed first");
406 if (!
bool.TryParse(args[2], out val))
409 m_bypassPermissionsValue = val;
411 m_log.InfoFormat(
"[PERMISSIONS] Forced permissions to {0} in {1}", m_bypassPermissionsValue, m_scene.RegionInfo.RegionName);
417 if (m_scene.ConsoleScene() != null &&
418 m_scene.ConsoleScene() != m_scene)
427 if (!
bool.TryParse(args[2], out val))
430 m_debugPermissions = val;
432 m_log.InfoFormat(
"[PERMISSIONS] Set permissions debugging to {0} in {1}", m_debugPermissions, m_scene.RegionInfo.RegionName);
438 #region Helper Functions
441 m_scene.EventManager.TriggerPermissionError(user, reason);
446 if (m_debugPermissions)
447 m_log.Debug(
"[PERMISSIONS]: " + permissionCalled +
" was called from " + m_scene.RegionInfo.RegionName);
460 if (null == GroupsModule)
467 if (((gmd.
GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers)
481 private static UserSet ParseUserSetConfigSetting(IConfigSource config,
string settingName, UserSet defaultValue)
483 UserSet userSet = defaultValue;
485 string rawSetting = Util.GetConfigVarFromSections<
string>(config, settingName,
486 new string[] {
"Startup",
"Permissions"}, defaultValue.ToString());
490 if (
"gods" == rawSetting.ToLower())
491 rawSetting = UserSet.Administrators.ToString();
496 userSet = (UserSet)Enum.Parse(typeof(UserSet), rawSetting,
true);
501 "[PERMISSIONS]: {0} is not a valid {1} value, setting to {2}",
502 rawSetting, settingName, userSet);
505 m_log.DebugFormat(
"[PERMISSIONS]: {0} {1}", settingName, userSet);
517 if (user ==
UUID.Zero)
520 if (m_scene.RegionInfo.EstateSettings.EstateOwner == user && m_RegionOwnerIsGod)
523 if (IsEstateManager(user) && m_RegionManagerIsGod)
526 if (IsGridGod(user, null))
540 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
541 if (m_bypassPermissions)
return m_bypassPermissionsValue;
543 if (user ==
UUID.Zero)
return false;
551 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user);
561 if (user ==
UUID.Zero)
564 if (FriendsModule == null)
567 int friendPerms = FriendsModule.GetRightsGrantedByFriend(user, objectOwner);
568 return (friendPerms & (
int)FriendRights.CanModifyObjects) != 0;
573 if (user ==
UUID.Zero)
return false;
575 return m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(user);
582 if (m_bypassPermissions)
585 return m_propagatePermissions;
590 return m_bypassPermissions;
595 m_bypassPermissions=value;
598 #region Object Permissions
619 uint objflags = task.GetEffectiveObjectFlags();
620 UUID objectOwner = task.OwnerID;
628 #pragma warning disable 0612
639 #pragma warning restore 0612
643 uint objectOwnerMask = ApplyObjectModifyMasks(task.
OwnerMask, objflags);
644 objectOwnerMask |= (uint)
PrimFlags.ObjectYouOwner | (uint)PrimFlags.ObjectAnyOwner | (uint)
PrimFlags.ObjectOwnerModify;
647 uint objectGroupMask = ApplyObjectModifyMasks(task.
GroupMask, objflags);
650 uint objectEveryoneMask = ApplyObjectModifyMasks(task.
EveryoneMask, objflags);
651 if (objectOwner !=
UUID.Zero)
652 objectEveryoneMask |= (uint)
PrimFlags.ObjectAnyOwner;
656 switch (permissionClass)
658 case PermissionClass.Owner:
659 return objectOwnerMask;
660 case PermissionClass.Group:
661 return objectGroupMask | objectEveryoneMask;
662 case PermissionClass.Everyone:
664 return objectEveryoneMask;
668 private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
675 objectFlagsMask |= (uint)
PrimFlags.ObjectCopy;
680 objectFlagsMask |= (uint)
PrimFlags.ObjectMove;
683 if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
685 objectFlagsMask |= (uint)
PrimFlags.ObjectModify;
688 if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
690 objectFlagsMask |= (uint)
PrimFlags.ObjectTransfer;
693 return objectFlagsMask;
699 return PermissionClass.Everyone;
701 if (m_bypassPermissions)
702 return PermissionClass.Owner;
705 UUID objectOwner = obj.OwnerID;
706 if (user == objectOwner)
707 return PermissionClass.Owner;
710 return PermissionClass.Owner;
713 if (m_RegionOwnerIsGod && IsEstateManager(user) && !IsAdministrator(objectOwner))
714 return PermissionClass.Owner;
717 if (IsAdministrator(user))
718 return PermissionClass.Owner;
721 Vector3 taskPos = obj.AbsolutePosition;
722 ILandObject parcel = m_scene.LandChannel.GetLandObject(taskPos.X, taskPos.Y);
723 if (parcel != null && parcel.
LandData.
OwnerID == user && m_ParcelOwnerIsGod)
726 if (!IsAdministrator(objectOwner))
748 bool permission =
false;
758 UUID objectOwner = group.OwnerID;
759 locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
767 if (locked && (!IsAdministrator(currentUser)) && denyOnLocked)
773 if (currentUser == objectOwner)
796 && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0)
797 && IsGroupMember(group.
GroupID, currentUser, 0))
804 if (IsFriendWithPerms(currentUser, objectOwner))
811 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
812 if ((parcel != null) && (parcel.LandData.OwnerID == currentUser))
818 if (IsEstateManager(currentUser))
824 if (IsAdministrator(objectOwner))
830 if (IsAdministrator(currentUser))
840 #region Generic Permissions
844 bool permission =
true;
845 string reason =
"Only registered users may communicate with another account.";
848 if (IsAdministrator(user))
851 if (IsEstateManager(user))
855 SendPermissionError(user, reason);
863 bool permission =
false;
866 if (IsEstateManager(user))
870 if (IsAdministrator(user))
878 bool permission =
false;
890 if (IsEstateManager(user))
895 if (IsAdministrator(user))
900 if (m_SimpleBuildPermissions &&
922 if (allowEstateManager && IsEstateManager(user))
927 if (IsAdministrator(user))
937 ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
938 if (parcel == null)
return false;
939 return GenericParcelPermission(user, parcel, groupPowers);
943 #region Permission Checks
946 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
947 if (m_bypassPermissions)
return m_bypassPermissionsValue;
949 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandRelease,
false);
954 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
955 if (m_bypassPermissions)
return m_bypassPermissionsValue;
957 return GenericParcelOwnerPermission(user, parcel, 0,
true);
962 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
963 if (m_bypassPermissions)
return m_bypassPermissionsValue;
971 if ((client.GetGroupPowers(parcel.
LandData.
GroupID) & (ulong)GroupPowers.LandDeed) == 0)
974 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed,
false);
977 private bool CanDeedObject(UUID user, UUID group,
Scene scene)
979 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
980 if (m_bypassPermissions)
return m_bypassPermissionsValue;
985 if ((client.GetGroupPowers(group) & (ulong)GroupPowers.DeedObject) == 0)
991 private bool IsGod(UUID user,
Scene scene)
993 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
994 if (m_bypassPermissions)
return m_bypassPermissionsValue;
996 return IsAdministrator(user);
999 private bool CanDuplicateObject(
int objectCount, UUID objectID, UUID owner,
Scene scene, Vector3 objectPosition)
1001 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1002 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1004 if (!GenericObjectPermission(owner, objectID,
true))
1029 return CanRezObject(objectCount, owner, objectPosition, scene);
1032 private bool CanDeleteObject(UUID objectID, UUID deleter,
Scene scene)
1034 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1035 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1037 return GenericObjectPermission(deleter, objectID,
false);
1040 private bool CanEditObject(UUID objectID, UUID editorID,
Scene scene)
1042 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1043 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1045 return GenericObjectPermission(editorID, objectID,
false);
1048 private bool CanEditObjectInventory(UUID objectID, UUID editorID,
Scene scene)
1050 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1051 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1053 return GenericObjectPermission(editorID, objectID,
false);
1056 private bool CanEditParcelProperties(UUID user,
ILandObject parcel, GroupPowers p,
Scene scene,
bool allowManager)
1058 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1059 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1061 return GenericParcelOwnerPermission(user, parcel, (ulong)p,
false);
1072 private bool CanEditScript(UUID script, UUID objectID, UUID user,
Scene scene)
1074 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1075 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1077 if (m_allowedScriptEditors == UserSet.Administrators && !IsAdministrator(user))
1083 return CanViewScript(script, objectID, user, scene);
1094 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user,
Scene scene)
1096 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1097 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1099 if (objectID ==
UUID.Zero)
1103 assetRequestItem = invService.GetItem(assetRequestItem);
1104 if (assetRequestItem == null && LibraryRootFolder != null)
1106 assetRequestItem = LibraryRootFolder.FindItem(notecard);
1108 if (assetRequestItem != null)
1120 ((uint)PermissionMask.Modify |
1136 if (!IsGroupMember(part.
GroupID, user, 0))
1139 if ((part.
GroupMask & (uint)PermissionMask.Modify) == 0)
1144 if ((part.
OwnerMask & (uint)PermissionMask.Modify) == 0)
1158 if (!IsGroupMember(ti.
GroupID, user, 0))
1164 ((uint)PermissionMask.Modify |
1166 ((uint)PermissionMask.Modify |
1174 private bool CanInstantMessage(UUID user, UUID target,
Scene startScene)
1176 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1177 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1183 user = part.OwnerID;
1185 return GenericCommunicationPermission(user, target);
1188 private bool CanInventoryTransfer(UUID user, UUID target,
Scene startScene)
1190 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1191 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1193 return GenericCommunicationPermission(user, target);
1196 private bool CanIssueEstateCommand(UUID user,
Scene requestFromScene,
bool ownerCommand)
1198 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1199 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1201 if (IsAdministrator(user))
1204 if (m_scene.RegionInfo.EstateSettings.IsEstateOwner(user))
1210 return GenericEstatePermission(user);
1213 private bool CanMoveObject(UUID objectID, UUID moverID,
Scene scene)
1215 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1216 if (m_bypassPermissions)
1227 return m_bypassPermissionsValue;
1230 bool permission = GenericObjectPermission(moverID, objectID,
true);
1233 if (!m_scene.Entities.ContainsKey(objectID))
1249 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
1267 bool locked =
false;
1268 if (!m_scene.Entities.ContainsKey(objectID))
1274 if ((!(m_scene.Entities[objectID] is SceneObjectGroup)))
1279 SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objectID];
1281 UUID objectOwner = group.
OwnerID;
1294 if (locked && (moverID == objectOwner))
1300 private bool CanObjectEntry(UUID objectID,
bool enteringRegion, Vector3 newPoint,
Scene scene)
1302 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1303 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1305 if ((newPoint.X > 257f || newPoint.X < -1f || newPoint.Y > 257f || newPoint.Y < -1f))
1310 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
1312 ILandObject land = m_scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
1314 if (!enteringRegion)
1316 ILandObject fromland = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
1318 if (fromland == land)
1327 if ((
land.LandData.Flags & ((
int)ParcelFlags.AllowAPrimitiveEntry)) != 0)
1332 if (!m_scene.Entities.ContainsKey(objectID))
1338 if (!(m_scene.Entities[objectID] is SceneObjectGroup))
1344 if (GenericParcelPermission(task.
OwnerID, newPoint, 0))
1353 private bool CanReturnObjects(
ILandObject land, UUID user, List<SceneObjectGroup> objects,
Scene scene)
1355 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1356 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1367 foreach (SceneObjectGroup g
in new List<SceneObjectGroup>(objects))
1371 if (GenericObjectPermission(user, g.
UUID,
false))
1384 Vector3 pos = g.AbsolutePosition;
1386 l = scene.LandChannel.GetLandObject(pos.X, pos.Y);
1408 if (powers == (GroupPowers)0)
1417 (powers & GroupPowers.ReturnGroupOwned) == (GroupPowers)0)
1426 (powers & GroupPowers.ReturnGroupSet) == (GroupPowers)0)
1432 if ((powers & GroupPowers.ReturnNonGroup) == (GroupPowers)0)
1449 if (objects.Count == 0)
1455 private bool CanRezObject(
int objectCount, UUID owner, Vector3 objectPosition,
Scene scene)
1457 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1458 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1462 ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
1466 if ((parcel.
LandData.
Flags & (uint)ParcelFlags.CreateObjects) != 0)
1470 else if ((owner == parcel.
LandData.
OwnerID) || IsAdministrator(owner))
1474 else if (((parcel.
LandData.
Flags & (uint)ParcelFlags.CreateGroupObjects) != 0)
1475 && (parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.
LandData.
GroupID, owner, 0))
1489 private bool CanRunConsoleCommand(UUID user,
Scene requestFromScene)
1491 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1492 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1495 return IsAdministrator(user);
1498 private bool CanRunScript(UUID script, UUID objectID, UUID user,
Scene scene)
1500 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1501 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1508 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1509 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1511 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandSetSale,
false);
1514 private bool CanTakeObject(UUID objectID, UUID stealer,
Scene scene)
1516 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1517 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1519 return GenericObjectPermission(stealer,objectID,
false);
1522 private bool CanTakeCopyObject(UUID objectID, UUID userID,
Scene inScene)
1524 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1525 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1527 bool permission = GenericObjectPermission(userID, objectID,
false);
1529 SceneObjectGroup so = (SceneObjectGroup)m_scene.Entities[objectID];
1533 if (!m_scene.Entities.ContainsKey(objectID))
1539 if (!(m_scene.Entities[objectID] is SceneObjectGroup))
1567 private bool CanTerraformLand(UUID user, Vector3 position,
Scene requestFromScene)
1569 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1570 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1573 if (GenericEstatePermission(user))
1576 float X = position.X;
1577 float Y = position.Y;
1579 if (X > ((
int)m_scene.RegionInfo.RegionSizeX - 1))
1580 X = ((
int)m_scene.RegionInfo.RegionSizeX - 1);
1581 if (Y > ((
int)m_scene.RegionInfo.RegionSizeY - 1))
1582 Y = ((
int)m_scene.RegionInfo.RegionSizeY - 1);
1588 ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y);
1593 if ((parcel.
LandData.
Flags & ((
int)ParcelFlags.AllowTerraform)) != 0)
1597 if (parcel != null && GenericParcelPermission(user, parcel, (ulong)GroupPowers.AllowEditLand))
1611 private bool CanViewScript(UUID script, UUID objectID, UUID user,
Scene scene)
1613 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1614 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1616 if (objectID ==
UUID.Zero)
1620 assetRequestItem = invService.GetItem(assetRequestItem);
1621 if (assetRequestItem == null && LibraryRootFolder != null)
1623 assetRequestItem = LibraryRootFolder.FindItem(script);
1625 if (assetRequestItem != null)
1643 ((uint)PermissionMask.Modify |
1645 (uint)PermissionMask.Transfer))
1660 if (!IsGroupMember(part.
GroupID, user, 0))
1663 if ((part.
GroupMask & (uint)PermissionMask.Modify) == 0)
1668 if ((part.
OwnerMask & (uint)PermissionMask.Modify) == 0)
1682 if (!IsGroupMember(ti.
GroupID, user, 0))
1688 ((uint)PermissionMask.Modify |
1690 (uint)PermissionMask.Transfer)) !=
1692 (uint)PermissionMask.Copy |
1708 private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user,
Scene scene)
1710 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1711 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1713 if (objectID ==
UUID.Zero)
1717 assetRequestItem = invService.GetItem(assetRequestItem);
1718 if (assetRequestItem == null && LibraryRootFolder != null)
1720 assetRequestItem = LibraryRootFolder.FindItem(notecard);
1722 if (assetRequestItem != null)
1729 (uint)PermissionMask.Copy) !=
1730 (uint)PermissionMask.Copy)
1745 if (!IsGroupMember(part.
GroupID, user, 0))
1749 if ((part.
OwnerMask & (uint)PermissionMask.Modify) == 0)
1762 if (!IsGroupMember(ti.
GroupID, user, 0))
1769 (uint)PermissionMask.Copy) !=
1770 (uint)PermissionMask.Copy)
1779 private bool CanLinkObject(UUID userID, UUID objectID)
1781 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1782 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1784 return GenericObjectPermission(userID, objectID,
false);
1787 private bool CanDelinkObject(UUID userID, UUID objectID)
1789 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1790 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1792 return GenericObjectPermission(userID, objectID,
false);
1797 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1798 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1803 private bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID)
1805 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1806 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1811 private bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
1813 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1814 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1827 private bool CanCreateObjectInventory(
int invType, UUID objectID, UUID userID)
1829 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1830 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1835 if (part == null || p == null)
1838 if (!IsAdministrator(userID))
1843 if ((part.
GroupID ==
UUID.Zero) || (p.ControllingClient.GetGroupPowers(part.GroupID) == 0) || ((part.GroupMask & (uint)
PermissionMask.Modify) == 0))
1846 if ((part.
OwnerMask & (uint)PermissionMask.Modify) == 0)
1849 if ((
int)InventoryType.LSL == invType)
1850 if (m_allowedScriptCreators == UserSet.Administrators)
1863 private bool CanCreateUserInventory(
int invType, UUID userID)
1865 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1866 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1868 if ((
int)InventoryType.LSL == invType)
1869 if (m_allowedScriptCreators == UserSet.Administrators && !IsAdministrator(userID))
1881 private bool CanCopyUserInventory(UUID itemID, UUID userID)
1883 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1884 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1895 private bool CanEditUserInventory(UUID itemID, UUID userID)
1897 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1898 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1909 private bool CanDeleteUserInventory(UUID itemID, UUID userID)
1911 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1912 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1917 private bool CanTeleport(UUID userID,
Scene scene)
1919 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1920 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1925 private bool CanResetScript(UUID prim, UUID script, UUID agentID,
Scene scene)
1927 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1928 if (m_bypassPermissions)
return m_bypassPermissionsValue;
1934 if (part.
ParentID != 0) prim = part.ParentUUID;
1937 return GenericObjectPermission(agentID, prim,
false);
1940 private bool CanCompileScript(UUID ownerUUID,
int scriptType,
Scene scene)
1943 switch (scriptType) {
1945 if (GrantLSL.Count == 0 || GrantLSL.ContainsKey(ownerUUID.ToString())) {
1950 if (GrantCS.Count == 0 || GrantCS.ContainsKey(ownerUUID.ToString())) {
1955 if (GrantVB.Count == 0 || GrantVB.ContainsKey(ownerUUID.ToString())) {
1960 if (GrantJS.Count == 0 || GrantJS.ContainsKey(ownerUUID.ToString()))
1966 if (GrantYP.Count == 0 || GrantYP.ContainsKey(ownerUUID.ToString()))
1975 private bool CanControlPrimMedia(UUID agentID, UUID primID,
int face)
1981 if (null == MoapModule)
1988 MediaEntry me = MoapModule.GetMediaEntry(part, face);
1998 return GenericObjectPermission(agentID, part.ParentGroup.UUID,
true);
2001 private bool CanInteractWithPrimMedia(UUID agentID, UUID primID,
int face)
2007 if (null == MoapModule)
2014 MediaEntry me = MoapModule.GetMediaEntry(part, face);
2024 return GenericPrimMediaPermission(part, agentID, me.InteractPermissions);
2027 private bool GenericPrimMediaPermission(
SceneObjectPart part, UUID agentID, MediaPermission perms)
2032 if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone)
2035 if ((perms & MediaPermission.Owner) == MediaPermission.Owner)
2041 if ((perms & MediaPermission.Group) == MediaPermission.Group)
2043 if (IsGroupMember(part.
GroupID, agentID, 0))
uint GetEffectivePermissions()
bool GenericObjectPermission(UUID currentUser, UUID objId, bool denyOnLocked)
General permissions checks for any operation involving an object. These supplement more specific chec...
void HandleBypassPermissions(string module, string[] args)
ulong GetGroupPowers(UUID groupID)
bool GenericCommunicationPermission(UUID user, UUID target)
void DebugPermissionInformation(string permissionCalled)
bool PropagatePermissions()
bool IsEstateManager(UUID user)
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
Represents an item in a task inventory
bool IsGridGod(UUID user, Scene scene)
Is the given user a God throughout the grid (not just in the current scene)?
bool GenericParcelPermission(UUID user, ILandObject parcel, ulong groupPowers)
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
Checks if the given group is active and if the user is a group member with the powers requested (powe...
void SendPermissionError(UUID user, string reason)
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...
bool IsDeleted
Signals whether this entity was in a scene but has since been removed from it.
bool IsFriendWithPerms(UUID user, UUID objectOwner)
void HandleForcePermissions(string module, string[] args)
void SetBypassPermissions(bool value)
UUID GroupID
Unique ID of the Group that owns
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
PermissionClass GetPermissionClass(UUID user, SceneObjectPart obj)
Returns the type of permissions that the user has over an object.
Inventory Item - contains all the properties associated with an individual inventory piece...
uint GenerateClientFlags(UUID user, UUID objID)
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
OpenSim.Framework.PermissionMask PermissionMask
Interactive OpenSim region server
bool IsAdministrator(UUID user)
Is the user regarded as an administrator?
bool GenericEstatePermission(UUID user)
SceneObjectGroup ParentGroup
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
uint ParentID
The parent ID of this part.
bool IsGroupOwned
Returns true if the Land Parcel is owned by a group
bool GenericParcelPermission(UUID user, Vector3 pos, ulong groupPowers)
uint Flags
Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags ...
bool IsInLandAccessList(UUID avatar)
void HandleDebugPermissions(string module, string[] args)
Provides methods from manipulating media-on-a-prim
bool GenericParcelOwnerPermission(UUID user, ILandObject parcel, ulong groupPowers, bool allowEstateManager)
bool IsAttachment
Is this scene object acting as an attachment?
UUID OwnerID
Owner Avatar or Group of the parcel. Naturally, all land masses must be owned by someone ...