diff options
author | Justin Clark-Casey (justincc) | 2010-07-13 23:19:45 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-13 23:19:45 +0100 |
commit | 6f644f5322ee0c5ffe6c654387981f1c13f7112d (patch) | |
tree | 818903820f1af3a1760e89ec470d4bf36388f918 /OpenSim/Region/CoreModules/World/Permissions | |
parent | discard an object media update message if it tries to set more media textures... (diff) | |
download | opensim-SC_OLD-6f644f5322ee0c5ffe6c654387981f1c13f7112d.zip opensim-SC_OLD-6f644f5322ee0c5ffe6c654387981f1c13f7112d.tar.gz opensim-SC_OLD-6f644f5322ee0c5ffe6c654387981f1c13f7112d.tar.bz2 opensim-SC_OLD-6f644f5322ee0c5ffe6c654387981f1c13f7112d.tar.xz |
implement prim media control permissions serverside in order to stop bad clients
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 69b247c..358ea59 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -164,6 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
164 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); | 164 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); |
165 | private IFriendsModule m_friendsModule; | 165 | private IFriendsModule m_friendsModule; |
166 | private IGroupsModule m_groupsModule; | 166 | private IGroupsModule m_groupsModule; |
167 | private IMoapModule m_moapModule; | ||
167 | 168 | ||
168 | #endregion | 169 | #endregion |
169 | 170 | ||
@@ -248,6 +249,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
248 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED | 249 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED |
249 | 250 | ||
250 | m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED | 251 | m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED |
252 | |||
253 | m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; | ||
251 | 254 | ||
252 | m_scene.AddCommand(this, "bypass permissions", | 255 | m_scene.AddCommand(this, "bypass permissions", |
253 | "bypass permissions <true / false>", | 256 | "bypass permissions <true / false>", |
@@ -393,6 +396,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
393 | 396 | ||
394 | if (m_groupsModule == null) | 397 | if (m_groupsModule == null) |
395 | m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); | 398 | m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); |
399 | |||
400 | m_moapModule = m_scene.RequestModuleInterface<IMoapModule>(); | ||
396 | } | 401 | } |
397 | 402 | ||
398 | public void Close() | 403 | public void Close() |
@@ -1893,5 +1898,41 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1893 | } | 1898 | } |
1894 | return(false); | 1899 | return(false); |
1895 | } | 1900 | } |
1901 | |||
1902 | private bool CanControlPrimMedia(UUID agentID, UUID primID, int face) | ||
1903 | { | ||
1904 | if (null == m_moapModule) | ||
1905 | return false; | ||
1906 | |||
1907 | SceneObjectPart part = m_scene.GetSceneObjectPart(primID); | ||
1908 | if (null == part) | ||
1909 | return false; | ||
1910 | |||
1911 | MediaEntry me = m_moapModule.GetMediaEntry(part, face); | ||
1912 | |||
1913 | // If there is no existing media entry then it can be controlled (in this context, created). | ||
1914 | if (null == me) | ||
1915 | return true; | ||
1916 | |||
1917 | if (IsAdministrator(agentID)) | ||
1918 | return true; | ||
1919 | |||
1920 | if ((me.ControlPermissions & MediaPermission.Anyone) == MediaPermission.Anyone) | ||
1921 | return true; | ||
1922 | |||
1923 | if ((me.ControlPermissions & MediaPermission.Owner) == MediaPermission.Owner) | ||
1924 | { | ||
1925 | if (agentID == part.OwnerID) | ||
1926 | return true; | ||
1927 | } | ||
1928 | |||
1929 | if ((me.ControlPermissions & MediaPermission.Group) == MediaPermission.Group) | ||
1930 | { | ||
1931 | if (IsGroupMember(part.GroupID, agentID, 0)) | ||
1932 | return true; | ||
1933 | } | ||
1934 | |||
1935 | return false; | ||
1936 | } | ||
1896 | } | 1937 | } |
1897 | } | 1938 | } \ No newline at end of file |