Beispiel #1
0
  public List<PrivilegeInfo> fetchClassPrivilegesForGroup(final Long groupId) {
    final List<PrivilegeInfo> fetchedClassPrivileges =
        fetchStoredPrivilegesForGroup( //
            groupId, //
            PrivilegedObjectType.CLASS //
            );

    final Iterable<CMClass> nonReservedActiveClasses = filterNonReservedAndNonBaseClasses();

    for (final CMClass clazz : nonReservedActiveClasses) {
      final Long classId = clazz.getId();
      if (!isPrivilegeAlreadyStored(classId, fetchedClassPrivileges)) {
        final PrivilegeInfo pi = new PrivilegeInfo(groupId, clazz, PrivilegeMode.NONE);

        final List<String> attributesPrivileges = new ArrayList<String>();
        for (final CMAttribute attribute : clazz.getAttributes()) {
          final String mode = attribute.getMode().name().toLowerCase();
          attributesPrivileges.add(String.format("%s:%s", attribute.getName(), mode));
        }

        pi.setAttributesPrivileges( //
            attributesPrivileges.toArray(new String[attributesPrivileges.size()]) //
            );

        fetchedClassPrivileges.add(pi);
      }
    }
    return fetchedClassPrivileges;
  }
Beispiel #2
0
  private Map<String, String> attributesMode(final CMEntryType entryType) {
    final Map<String, String> privileges = new HashMap<String, String>();
    for (final CMAttribute attribute : entryType.getActiveAttributes()) {
      if (attribute.isActive()) {
        final String mode = attribute.getMode().name().toLowerCase();
        privileges.put(attribute.getName(), mode);
      }
    }

    return privileges;
  }