test_class.declarator: READ_PERMISSIONS =
              EffectedPermissions.newInstance(Collections.singleton(Permission.READ.name()),
                      Collections.emptyList())
test_class.modifier: private static final
test_class.original_string: private static final EffectedPermissions READ_PERMISSIONS =
              EffectedPermissions.newInstance(Collections.singleton(Permission.READ.name()),
                      Collections.emptyList());
test_class.type: EffectedPermissions
test_class.var_name: READ_PERMISSIONS
test_class.declarator: REVOKED_WRITE_PERMISSIONS =
              EffectedPermissions.newInstance(Collections.emptyList(), Collections.singleton(Permission.WRITE.name()))
test_class.modifier: private static final
test_class.original_string: private static final EffectedPermissions REVOKED_WRITE_PERMISSIONS =
              EffectedPermissions.newInstance(Collections.emptyList(), Collections.singleton(Permission.WRITE.name()));
test_class.type: EffectedPermissions
test_class.var_name: REVOKED_WRITE_PERMISSIONS
test_class.file: services/models/policies/src/test/java/org/eclipse/ditto/services/models/policies/PoliciesAclMigrationsTest.java
test_class.identifier: PoliciesAclMigrationsTest
test_case.body: @Test
      public void verifyMigratedSubjects() {
          final SubjectId subjectId = SubjectId.newInstance(SubjectIssuer.GOOGLE, "user");
          final AccessControlList aclToMigrate = AccessControlList.newBuilder()
                  .set(AclEntry.newInstance(AuthorizationSubject.newInstance(subjectId), Permission.READ))
                  .build();
          final PolicyId policyId = PolicyId.dummy();
          final List<SubjectIssuer> issuers = Arrays.asList(SubjectIssuer.GOOGLE, SubjectIssuer.newInstance("any-other"));
  
          final String expectedLabel = "acl_" + subjectId.getSubject();
          final PolicyEntry expectedEntry = createExpectedPolicyEntry(expectedLabel, subjectId, issuers);
  
          final Policy migratedPolicy =
                  PoliciesAclMigrations.accessControlListToPolicyEntries(aclToMigrate, policyId, issuers);
  
          assertThat(migratedPolicy.getEntryFor(expectedLabel)).contains(expectedEntry);
      }
test_case.class_method_signature: PoliciesAclMigrationsTest.verifyMigratedSubjects()
test_case.full_signature: @Test public void verifyMigratedSubjects()
test_case.identifier: verifyMigratedSubjects
test_case.invocations: newInstance build set newBuilder newInstance newInstance dummy asList newInstance getSubject createExpectedPolicyEntry accessControlListToPolicyEntries contains assertThat getEntryFor
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void verifyMigratedSubjects()
focal_class.declarator: ACL_LABEL_PREFIX = "acl_"
focal_class.modifier: public static final
focal_class.original_string: public static final String ACL_LABEL_PREFIX = "acl_";
focal_class.type: String
focal_class.var_name: ACL_LABEL_PREFIX
focal_class.declarator: ROOT_PATH = JsonPointer.empty()
focal_class.modifier: private static final
focal_class.original_string: private static final JsonPointer ROOT_PATH = JsonPointer.empty();
focal_class.type: JsonPointer
focal_class.var_name: ROOT_PATH
focal_class.file: services/models/policies/src/main/java/org/eclipse/ditto/services/models/policies/PoliciesAclMigrations.java
focal_class.identifier: PoliciesAclMigrations
focal_class.class_method_signature: PoliciesAclMigrations.PoliciesAclMigrations()
focal_class.full_signature: private  PoliciesAclMigrations()
focal_class.identifier: PoliciesAclMigrations
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  PoliciesAclMigrations()
focal_class.class_method_signature: PoliciesAclMigrations.accessControlListToPolicyEntries(final AccessControlList accessControlList,
              final PolicyId policyId, final List<SubjectIssuer> subjectIssuers)
focal_class.full_signature: public static Policy accessControlListToPolicyEntries(final AccessControlList accessControlList,
              final PolicyId policyId, final List<SubjectIssuer> subjectIssuers)
focal_class.identifier: accessControlListToPolicyEntries
focal_class.modifiers: public static
focal_class.parameters: (final AccessControlList accessControlList,
              final PolicyId policyId, final List<SubjectIssuer> subjectIssuers)
focal_class.return: Policy
focal_class.signature: Policy accessControlListToPolicyEntries(final AccessControlList accessControlList,
              final PolicyId policyId, final List<SubjectIssuer> subjectIssuers)
focal_class.class_method_signature: PoliciesAclMigrations.getSubjectWithoutIssuer(final AclEntry aclEntry)
focal_class.full_signature: private static String getSubjectWithoutIssuer(final AclEntry aclEntry)
focal_class.identifier: getSubjectWithoutIssuer
focal_class.modifiers: private static
focal_class.parameters: (final AclEntry aclEntry)
focal_class.return: String
focal_class.signature: String getSubjectWithoutIssuer(final AclEntry aclEntry)
focal_method.body: public static Policy accessControlListToPolicyEntries(final AccessControlList accessControlList,
              final PolicyId policyId, final List<SubjectIssuer> subjectIssuers) {
          final PolicyBuilder policyBuilder = PoliciesModelFactory.newPolicyBuilder(policyId);
          accessControlList.getEntriesSet().forEach(aclEntry -> {
              final String sid = getSubjectWithoutIssuer(aclEntry);
              final PolicyBuilder.LabelScoped labelScoped = policyBuilder.forLabel(ACL_LABEL_PREFIX + sid);
  
              subjectIssuers.forEach(
                      subjectIssuer -> labelScoped.setSubject(subjectIssuer, sid));
  
              if (aclEntry.getPermissions().contains(org.eclipse.ditto.model.things.Permission.READ) &&
                      aclEntry.getPermissions()
                              .contains(org.eclipse.ditto.model.things.Permission.WRITE)) {
                  labelScoped.setGrantedPermissions(PoliciesResourceType.policyResource(ROOT_PATH), Permission.READ);
                  labelScoped.setGrantedPermissions(PoliciesResourceType.thingResource(ROOT_PATH), Permission.READ,
                          Permission.WRITE);
                  labelScoped.setGrantedPermissions(PoliciesResourceType.messageResource(ROOT_PATH), Permission.READ,
                          Permission.WRITE);
              } else if (aclEntry.getPermissions().contains(org.eclipse.ditto.model.things.Permission.READ)) {
                  labelScoped.setGrantedPermissions(PoliciesResourceType.policyResource(ROOT_PATH), Permission.READ);
                  labelScoped.setGrantedPermissions(PoliciesResourceType.thingResource(ROOT_PATH), Permission.READ);
                  labelScoped.setGrantedPermissions(PoliciesResourceType.messageResource(ROOT_PATH), Permission.READ);
              } else if (aclEntry.getPermissions().contains(org.eclipse.ditto.model.things.Permission.WRITE)) {
                  labelScoped.setGrantedPermissions(PoliciesResourceType.thingResource(ROOT_PATH), Permission.WRITE);
                  labelScoped.setGrantedPermissions(PoliciesResourceType.messageResource(ROOT_PATH), Permission.WRITE);
              }
  
              if (aclEntry.getPermissions().contains(org.eclipse.ditto.model.things.Permission.ADMINISTRATE)) {
                  // allow reading+writing policy:/ if the ACL entry has Administrate permission
                  labelScoped.setGrantedPermissions(PoliciesResourceType.policyResource(ROOT_PATH),
                          Permission.READ, Permission.WRITE);
                  // allow writing thing:/acl if the ACL entry has Administrate permission
                  labelScoped.setGrantedPermissions(PoliciesResourceType.thingResource(Thing.JsonFields.ACL.getPointer()),
                          Permission.READ, Permission.WRITE);
              } else {
                  // forbid writing thing:/acl if the ACL entry was missing Administrate permission
                  labelScoped.setRevokedPermissions(PoliciesResourceType.thingResource(Thing.JsonFields.ACL.getPointer()),
                          Permission.WRITE);
              }
          });
          return policyBuilder.build();
      }
focal_method.class_method_signature: PoliciesAclMigrations.accessControlListToPolicyEntries(final AccessControlList accessControlList,
              final PolicyId policyId, final List<SubjectIssuer> subjectIssuers)
focal_method.full_signature: public static Policy accessControlListToPolicyEntries(final AccessControlList accessControlList,
              final PolicyId policyId, final List<SubjectIssuer> subjectIssuers)
focal_method.identifier: accessControlListToPolicyEntries
focal_method.invocations: newPolicyBuilder forEach getEntriesSet getSubjectWithoutIssuer forLabel forEach setSubject contains getPermissions contains getPermissions setGrantedPermissions policyResource setGrantedPermissions thingResource setGrantedPermissions messageResource contains getPermissions setGrantedPermissions policyResource setGrantedPermissions thingResource setGrantedPermissions messageResource contains getPermissions setGrantedPermissions thingResource setGrantedPermissions messageResource contains getPermissions setGrantedPermissions policyResource setGrantedPermissions thingResource getPointer setRevokedPermissions thingResource getPointer build
focal_method.modifiers: public static
focal_method.parameters: (final AccessControlList accessControlList,
              final PolicyId policyId, final List<SubjectIssuer> subjectIssuers)
focal_method.return: Policy
focal_method.signature: Policy accessControlListToPolicyEntries(final AccessControlList accessControlList,
              final PolicyId policyId, final List<SubjectIssuer> subjectIssuers)