From 91fd9c467083a57e2898594ce3ae764aa0525bb5 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Tue, 5 Nov 2013 15:42:23 +0200
Subject: Refactored: use a single function to apply an object's folded
permissions to its main permissions
---
OpenSim/Framework/PermissionsUtil.cs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs
index 3dce04d..d785a78 100644
--- a/OpenSim/Framework/PermissionsUtil.cs
+++ b/OpenSim/Framework/PermissionsUtil.cs
@@ -64,5 +64,24 @@ namespace OpenSim.Framework
str = ".";
return str;
}
+
+ ///
+ /// Applies an object's folded permissions to its regular permissions.
+ ///
+ /// The folded permissions. Only the lowest 7 bits are examined.
+ /// The permissions variable to modify.
+ public static void ApplyFoldedPermissions(uint foldedPerms, ref uint mainPerms)
+ {
+ if ((foldedPerms & 7) == 0)
+ return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded
+
+ if ((foldedPerms & ((uint)PermissionMask.Copy >> 13)) == 0)
+ mainPerms &= ~(uint)PermissionMask.Copy;
+ if ((foldedPerms & ((uint)PermissionMask.Transfer >> 13)) == 0)
+ mainPerms &= ~(uint)PermissionMask.Transfer;
+ if ((foldedPerms & ((uint)PermissionMask.Modify >> 13)) == 0)
+ mainPerms &= ~(uint)PermissionMask.Modify;
+ }
+
}
}
--
cgit v1.1