Example #1
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();
 }
Example #2
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();
  }