javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermission.java
branchRCL_3
changeset 21 4376525cdefb
parent 14 04becd199f91
--- a/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermission.java	Wed Jun 09 09:34:07 2010 +0300
+++ b/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermission.java	Mon Jun 21 15:32:50 2010 +0300
@@ -52,12 +52,13 @@
         String name,
         String target,
         String actionList,
+        int type,
         SecurityPolicyPermissionSettings settings)
     {
         this.name = name;
         this.target = target;
         this.actionList = actionList;
-        this.type = USER_TYPE;
+        this.type = type;
         this.settings = settings;
     }
 
@@ -65,13 +66,18 @@
         String name,
         String target,
         String actionList,
+        SecurityPolicyPermissionSettings settings)
+    {
+        this(name, target, actionList, USER_TYPE, settings);
+    }
+
+    public SecurityPolicyPermission(
+        String name,
+        String target,
+        String actionList,
         int type)
     {
-        this.name = name;
-        this.target = target;
-        this.actionList = actionList;
-        // Check type
-        this.type = type;
+        this(name, target, actionList, type, null);
     }
 
     public int getType()
@@ -145,7 +151,7 @@
         return oStream.toByteArray();
     }
 
-    public static SecurityPolicyPermission getFromBytes(byte[] buf)
+    public static SecurityPolicyPermission getFromBytes(byte[] buf, boolean activeSettings)
     {
         int type = buf[SecurityPolicy.index];
         SecurityPolicy.index++;
@@ -155,10 +161,12 @@
         SecurityPolicy.index += nameLen;
         String target = readString(buf);
         String actionList = readString(buf);
-        if (type == USER_TYPE)
+        if (type == USER_TYPE || type == USER_ASSIGNED_TYPE)
         {
-            return new SecurityPolicyPermission(name, target, actionList,
-                                                SecurityPolicyPermissionSettings.getFromBytes(buf));
+            return new SecurityPolicyPermission(
+                name, target, actionList, type,
+                SecurityPolicyPermissionSettings.getFromBytes(
+                buf, activeSettings));
         }
         return new SecurityPolicyPermission(name, target, actionList, type);
     }