aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-04-19 21:02:36 +0100
committerJustin Clark-Casey (justincc)2010-05-26 21:12:56 +0100
commitd6e1333810b41407378a534a720128b498e0aada (patch)
treefa3cd62cc573cbffb41fb5ccff37e22c65c464d7 /OpenSim/Region/ClientStack/LindenUDP
parentcheck group membership and powers with the groups module rather than just the... (diff)
downloadopensim-SC-d6e1333810b41407378a534a720128b498e0aada.zip
opensim-SC-d6e1333810b41407378a534a720128b498e0aada.tar.gz
opensim-SC-d6e1333810b41407378a534a720128b498e0aada.tar.bz2
opensim-SC-d6e1333810b41407378a534a720128b498e0aada.tar.xz
If a transfer request is received for a task inventory item asset, then route the permissions request through the existing CanEditScript() and CanEditNotecard() methods.
This implements the 'share with group' flag for notecards and scripts in prim inventory since the PermissionsModule checks group membership and permissions. Other than that, the code in PermissionsModule duplicates the checks in LLClientView so there should be no change other than allowing group members to edit embedded notecards and scripts. For all other asset types, the permission checking code in LLClientView continues to be used, pending refactoring of suitable permissions code This means that 'share with group' will not yet work for prim inventory items other than notecards and scripts
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs99
1 files changed, 80 insertions, 19 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index bd0c146..c9ef173 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -7053,32 +7053,89 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7053 taskID = new UUID(transfer.TransferInfo.Params, 48); 7053 taskID = new UUID(transfer.TransferInfo.Params, 48);
7054 UUID itemID = new UUID(transfer.TransferInfo.Params, 64); 7054 UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
7055 UUID requestID = new UUID(transfer.TransferInfo.Params, 80); 7055 UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
7056
7057// m_log.DebugFormat(
7058// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
7059// requestID, itemID, taskID, Name);
7060
7056 if (!(((Scene)m_scene).Permissions.BypassPermissions())) 7061 if (!(((Scene)m_scene).Permissions.BypassPermissions()))
7057 { 7062 {
7058 if (taskID != UUID.Zero) // Prim 7063 if (taskID != UUID.Zero) // Prim
7059 { 7064 {
7060 SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); 7065 SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
7061 if (part == null) 7066 if (part == null)
7067 {
7068 m_log.WarnFormat(
7069 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
7070 Name, requestID, itemID, taskID);
7062 return true; 7071 return true;
7072 }
7063 7073
7064 if (part.OwnerID != AgentId) 7074 TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID);
7065 return true; 7075 if (tii == null)
7066 7076 {
7067 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 7077 m_log.WarnFormat(
7068 return true; 7078 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
7069 7079 Name, requestID, itemID, taskID);
7070 TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID);
7071 if (ti == null)
7072 return true;
7073
7074 if (ti.OwnerID != AgentId)
7075 return true;
7076
7077 if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
7078 return true;
7079
7080 if (ti.AssetID != requestID)
7081 return true; 7080 return true;
7081 }
7082
7083 if (tii.Type == (int)AssetType.LSLText)
7084 {
7085 if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
7086 return true;
7087 }
7088 else if (tii.Type == (int)AssetType.Notecard)
7089 {
7090 if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId))
7091 return true;
7092 }
7093 else
7094 {
7095 // TODO: Change this code to allow items other than notecards and scripts to be successfully
7096 // shared with group. In fact, all this permissions checking should move to an IPermissionsModule
7097 if (part.OwnerID != AgentId)
7098 {
7099 m_log.WarnFormat(
7100 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
7101 Name, requestID, itemID, taskID, part.OwnerID);
7102 return true;
7103 }
7104
7105 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
7106 {
7107 m_log.WarnFormat(
7108 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
7109 Name, requestID, itemID, taskID);
7110 return true;
7111 }
7112
7113 if (tii.OwnerID != AgentId)
7114 {
7115 m_log.WarnFormat(
7116 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
7117 Name, requestID, itemID, taskID, tii.OwnerID);
7118 return true;
7119 }
7120
7121 if ((
7122 tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
7123 != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
7124 {
7125 m_log.WarnFormat(
7126 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
7127 Name, requestID, itemID, taskID);
7128 return true;
7129 }
7130
7131 if (tii.AssetID != requestID)
7132 {
7133 m_log.WarnFormat(
7134 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
7135 Name, requestID, itemID, taskID, tii.AssetID);
7136 return true;
7137 }
7138 }
7082 } 7139 }
7083 else // Agent 7140 else // Agent
7084 { 7141 {
@@ -7114,7 +7171,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7114 } 7171 }
7115 7172
7116 if (assetRequestItem.AssetID != requestID) 7173 if (assetRequestItem.AssetID != requestID)
7174 {
7175 m_log.WarnFormat(
7176 "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
7177 Name, requestID, itemID, assetRequestItem.AssetID);
7117 return true; 7178 return true;
7179 }
7118 } 7180 }
7119 } 7181 }
7120 } 7182 }
@@ -11310,8 +11372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11310 // } 11372 // }
11311 } 11373 }
11312 11374
11313 //check to see if asset is in local cache, if not we need to request it from asset server. 11375// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
11314 //m_log.Debug("asset request " + requestID);
11315 11376
11316 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 11377 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
11317 11378