Exemple #1
0
  private void updateGrantCard(final CMCard grantCard, final PrivilegeInfo privilegeInfo) {
    final CMCardDefinition mutableGrantCard = view.update(grantCard);
    if (privilegeInfo.getMode() != null) {
      // check if null to allow the update of other attributes
      // without specify the mode
      mutableGrantCard.set(MODE_ATTRIBUTE, privilegeInfo.getMode().getValue()); //
    }

    mutableGrantCard //
        .set(PRIVILEGE_FILTER_ATTRIBUTE, privilegeInfo.getPrivilegeFilter()) //
        .set(ATTRIBUTES_PRIVILEGES_ATTRIBUTE, privilegeInfo.getAttributesPrivileges()) //
        .save();
  }
Exemple #2
0
 private void createFilterGrantCard(final PrivilegeInfo privilegeInfo) {
   final CMCardDefinition grantCardToBeCreated = view.createCardFor(grantClass);
   grantCardToBeCreated
       .set(GROUP_ID_ATTRIBUTE, privilegeInfo.getGroupId()) //
       .set(PRIVILEGED_OBJECT_ID_ATTRIBUTE, privilegeInfo.getPrivilegedObjectId()) //
       .set(MODE_ATTRIBUTE, privilegeInfo.getMode().getValue()) //
       .set(TYPE_ATTRIBUTE, PrivilegedObjectType.FILTER.getValue()) //
       .set(STATUS_ATTRIBUTE, CardStatus.ACTIVE.value()) //
       .save();
 }
Exemple #3
0
  private void createClassGrantCard(final PrivilegeInfo privilegeInfo) {
    final CMCardDefinition grantCardToBeCreated = view.createCardFor(grantClass);

    // manage the null value for the privilege mode
    // could happens updating row and column privileges
    PrivilegeMode privilegeMode = privilegeInfo.getMode();
    if (privilegeMode == null) {
      privilegeMode = PrivilegeMode.NONE;
    }

    grantCardToBeCreated //
        .set(GROUP_ID_ATTRIBUTE, privilegeInfo.getGroupId()) //
        .set(PRIVILEGED_CLASS_ID_ATTRIBUTE, privilegeInfo.getPrivilegedObjectId()) //
        .set(MODE_ATTRIBUTE, privilegeMode.getValue()) //
        .set(TYPE_ATTRIBUTE, PrivilegedObjectType.CLASS.getValue()) //
        .set(PRIVILEGE_FILTER_ATTRIBUTE, privilegeInfo.getPrivilegeFilter()) //
        .set(ATTRIBUTES_PRIVILEGES_ATTRIBUTE, privilegeInfo.getAttributesPrivileges()) //
        .set(STATUS_ATTRIBUTE, CardStatus.ACTIVE.value()) //
        .save();
  }