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 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();
  }
Example #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();
  }
Example #4
0
 public void saveGroupUIConfiguration(final Long groupId, final UIConfiguration configuration) {
   final CMClass roleClass = view.findClass("Role");
   final CMQueryRow row =
       view.select(anyAttribute(roleClass)) //
           .from(roleClass) //
           .where(condition(attribute(roleClass, "Id"), eq(groupId))) //
           .run()
           .getOnlyRow();
   final CMCard roleCard = row.getCard(roleClass);
   final CMCardDefinition cardDefinition = view.update(roleCard);
   if (isStringArrayNull(configuration.getDisabledModules())) {
     cardDefinition.set(GROUP_ATTRIBUTE_DISABLEDMODULES, null);
   } else {
     cardDefinition.set(GROUP_ATTRIBUTE_DISABLEDMODULES, configuration.getDisabledModules());
   }
   if (isStringArrayNull(configuration.getDisabledCardTabs())) {
     cardDefinition.set(GROUP_ATTRIBUTE_DISABLEDCARDTABS, null);
   } else {
     cardDefinition.set(GROUP_ATTRIBUTE_DISABLEDCARDTABS, configuration.getDisabledCardTabs());
   }
   if (isStringArrayNull(configuration.getDisabledProcessTabs())) {
     cardDefinition.set(GROUP_ATTRIBUTE_DISABLEDPROCESSTABS, null);
   } else {
     cardDefinition.set(
         GROUP_ATTRIBUTE_DISABLEDPROCESSTABS, configuration.getDisabledProcessTabs());
   }
   cardDefinition.set(GROUP_ATTRIBUTE_HIDESIDEPANEL, configuration.isHideSidePanel());
   cardDefinition.set(GROUP_ATTRIBUTE_FULLSCREEN, configuration.isFullScreenMode());
   cardDefinition.set(
       GROUP_ATTRIBUTE_SIMPLE_HISTORY_CARD, configuration.isSimpleHistoryModeForCard());
   cardDefinition.set(
       GROUP_ATTRIBUTE_SIMPLE_HISTORY_PROCESS, configuration.isSimpleHistoryModeForProcess());
   cardDefinition.set(
       GROUP_ATTRIBUTE_PROCESS_WIDGET_ALWAYS_ENABLED,
       configuration.isProcessWidgetAlwaysEnabled());
   // FIXME: manage cloud admin
   cardDefinition.save();
 }