Search in sources :

Example 1 with PasswordAccountDto

use of com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto in project midpoint by Evolveum.

the class ChangePasswordPanel method initLayout.

private void initLayout(final boolean oldPasswordVisible) {
    model = (LoadableModel<MyPasswordsDto>) getModel();
    Label oldPasswordLabel = new Label(ID_OLD_PASSWORD_LABEL, createStringResource("PageSelfCredentials.oldPasswordLabel"));
    add(oldPasswordLabel);
    oldPasswordLabel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return oldPasswordVisible;
        }
    });
    Label passwordLabel = new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1"));
    add(passwordLabel);
    PasswordTextField oldPasswordField = new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel<String>(model, MyPasswordsDto.F_OLD_PASSWORD));
    oldPasswordField.setRequired(false);
    oldPasswordField.setResetPassword(false);
    add(oldPasswordField);
    oldPasswordField.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        public boolean isVisible() {
            return oldPasswordVisible;
        }

        ;
    });
    PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new PropertyModel<ProtectedStringType>(model, MyPasswordsDto.F_PASSWORD));
    passwordPanel.getBaseFormComponent().add(new AttributeModifier("autofocus", ""));
    add(passwordPanel);
    WebMarkupContainer accountContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER);
    List<IColumn<PasswordAccountDto, String>> columns = initColumns();
    ListDataProvider<PasswordAccountDto> provider = new ListDataProvider<PasswordAccountDto>(this, new PropertyModel<List<PasswordAccountDto>>(model, MyPasswordsDto.F_ACCOUNTS));
    TablePanel accounts = new TablePanel(ID_ACCOUNTS_TABLE, provider, columns);
    accounts.setItemsPerPage(30);
    accounts.setShowPaging(false);
    if (model.getObject().getPropagation() != null && model.getObject().getPropagation().equals(CredentialsPropagationUserControlType.MAPPING)) {
        accountContainer.setVisible(false);
    }
    accountContainer.add(accounts);
    AjaxLink help = new AjaxLink(ID_BUTTON_HELP) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            showHelpPerformed(target);
        }
    };
    accountContainer.add(help);
    add(accountContainer);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) PasswordPanel(com.evolveum.midpoint.gui.api.component.password.PasswordPanel) Label(org.apache.wicket.markup.html.basic.Label) PasswordTextField(org.apache.wicket.markup.html.form.PasswordTextField) AttributeModifier(org.apache.wicket.AttributeModifier) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PasswordAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto) MyPasswordsDto(com.evolveum.midpoint.web.page.admin.home.dto.MyPasswordsDto) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 2 with PasswordAccountDto

use of com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto in project midpoint by Evolveum.

the class PageAbstractSelfCredentials method createPasswordAccountDto.

private PasswordAccountDto createPasswordAccountDto(PrismObject<ShadowType> account) {
    PrismReference resourceRef = account.findReference(ShadowType.F_RESOURCE_REF);
    String resourceName;
    if (resourceRef == null || resourceRef.getValue() == null || resourceRef.getValue().getObject() == null) {
        resourceName = getString("PageSelfCredentials.couldntResolve");
    } else {
        resourceName = WebComponentUtil.getName(resourceRef.getValue().getObject());
    }
    PasswordAccountDto passwordAccountDto = new PasswordAccountDto(account.getOid(), WebComponentUtil.getName(account), resourceName, WebComponentUtil.isActivationEnabled(account));
    passwordAccountDto.setPasswordOutbound(getPasswordOutbound(account));
    return passwordAccountDto;
}
Also used : PrismReference(com.evolveum.midpoint.prism.PrismReference) PasswordAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto)

Example 3 with PasswordAccountDto

use of com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto in project midpoint by Evolveum.

the class ChangePasswordPanel method initLayout.

private void initLayout() {
    WebMarkupContainer oldPasswordContainer = new WebMarkupContainer(ID_OLD_PASSWORD_CONTAINER);
    oldPasswordContainer.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isCheckOldPassword();
        }
    });
    add(oldPasswordContainer);
    PasswordTextField oldPasswordField = new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel<>(getModel(), MyPasswordsDto.F_OLD_PASSWORD));
    oldPasswordField.setRequired(false);
    oldPasswordContainer.add(oldPasswordField);
    Label passwordLabel = new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1"));
    add(passwordLabel);
    PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new PropertyModel<>(getModel(), MyPasswordsDto.F_PASSWORD), getModelObject().getFocus(), getPageBase()) {

        @Override
        protected <F extends FocusType> ValuePolicyType getValuePolicy(PrismObject<F> object) {
            return getModelObject().getFocusPolicy();
        }

        @Override
        protected void updatePasswordValidation(AjaxRequestTarget target) {
            super.updatePasswordValidation(target);
            limitationsByPolicyOid.clear();
            getTable().visitChildren(PasswordPolicyValidationPanel.class, (IVisitor<PasswordPolicyValidationPanel, PasswordPolicyValidationPanel>) (panel, iVisit) -> {
                panel.refreshValidationPopup(target);
            });
        }
    };
    passwordPanel.getBaseFormComponent().add(new AttributeModifier("autofocus", ""));
    add(passwordPanel);
    WebMarkupContainer accountContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER);
    List<IColumn<PasswordAccountDto, String>> columns = initColumns();
    ListDataProvider<PasswordAccountDto> provider = new ListDataProvider<>(this, new PropertyModel<>(getModel(), MyPasswordsDto.F_ACCOUNTS));
    TablePanel accounts = new TablePanel(ID_ACCOUNTS_TABLE, provider, columns);
    accounts.setItemsPerPage(30);
    accounts.setShowPaging(false);
    accountContainer.add(accounts);
    accountContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return shouldShowPasswordPropagation();
        }
    });
    add(accountContainer);
}
Also used : PageSelfCredentials(com.evolveum.midpoint.web.page.self.PageSelfCredentials) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) StringUtils(org.apache.commons.lang3.StringUtils) AuthUtil(com.evolveum.midpoint.authentication.api.util.AuthUtil) WebModelServiceUtils(com.evolveum.midpoint.gui.api.util.WebModelServiceUtils) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) Label(org.apache.wicket.markup.html.basic.Label) ProgressReportActivityDto(com.evolveum.midpoint.web.component.progress.ProgressReportActivityDto) Model(org.apache.wicket.model.Model) LabelWithHelpPanel(com.evolveum.midpoint.gui.api.component.LabelWithHelpPanel) WebComponentUtil(com.evolveum.midpoint.gui.api.util.WebComponentUtil) ResourceTypeUtil(com.evolveum.midpoint.schema.util.ResourceTypeUtil) Task(com.evolveum.midpoint.task.api.Task) AttributeModifier(org.apache.wicket.AttributeModifier) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) PropertyModel(org.apache.wicket.model.PropertyModel) Item(org.apache.wicket.markup.repeater.Item) PasswordAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto) MyPasswordsDto(com.evolveum.midpoint.web.page.admin.home.dto.MyPasswordsDto) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ResourceObjectDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectDefinition) java.util(java.util) GuiDisplayTypeUtil(com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil) com.evolveum.midpoint.web.component.data.column(com.evolveum.midpoint.web.component.data.column) com.evolveum.midpoint.xml.ns._public.common.common_3(com.evolveum.midpoint.xml.ns._public.common.common_3) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Trace(com.evolveum.midpoint.util.logging.Trace) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) CollectionUtils(org.apache.commons.collections4.CollectionUtils) GuiStyleConstants(com.evolveum.midpoint.gui.api.GuiStyleConstants) CredentialsCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CredentialsCapabilityType) StringLimitationResult(com.evolveum.midpoint.model.api.validator.StringLimitationResult) CapabilityUtil(com.evolveum.midpoint.schema.CapabilityUtil) IVisitor(org.apache.wicket.util.visit.IVisitor) Selectable(com.evolveum.midpoint.web.component.util.Selectable) DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) PasswordTextField(org.apache.wicket.markup.html.form.PasswordTextField) PrismObject(com.evolveum.midpoint.prism.PrismObject) PasswordPanel(com.evolveum.midpoint.gui.api.component.password.PasswordPanel) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) LoggingUtils(com.evolveum.midpoint.util.logging.LoggingUtils) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) PrismReference(com.evolveum.midpoint.prism.PrismReference) ProgressInformation(com.evolveum.midpoint.model.api.ProgressInformation) ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) TraceManager(com.evolveum.midpoint.util.logging.TraceManager) ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) PasswordPanel(com.evolveum.midpoint.gui.api.component.password.PasswordPanel) Label(org.apache.wicket.markup.html.basic.Label) PasswordTextField(org.apache.wicket.markup.html.form.PasswordTextField) AttributeModifier(org.apache.wicket.AttributeModifier) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) PrismObject(com.evolveum.midpoint.prism.PrismObject) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PasswordAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 4 with PasswordAccountDto

use of com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto in project midpoint by Evolveum.

the class ChangePasswordPanel method initColumns.

private List<IColumn<PasswordAccountDto, String>> initColumns() {
    List<IColumn<PasswordAccountDto, String>> columns = new ArrayList<>();
    columns.add(new CheckBoxColumn<>(Model.of(""), Selectable.F_SELECTED) {

        @Override
        protected IModel<Boolean> getEnabled(IModel<PasswordAccountDto> rowModel) {
            return () -> {
                PasswordAccountDto passwordAccountDto = rowModel.getObject();
                if (!passwordAccountDto.isMidpoint() && !passwordAccountDto.isPasswordCapabilityEnabled()) {
                    passwordAccountDto.setSelected(false);
                    return false;
                }
                if (CredentialsPropagationUserControlType.ONLY_MAPPING.equals(getModelObject().getPropagation())) {
                    if (!passwordAccountDto.isMidpoint() && !passwordAccountDto.isPasswordOutbound()) {
                        passwordAccountDto.setSelected(false);
                    }
                    return false;
                }
                if (passwordAccountDto.isMidpoint() && CredentialsPropagationUserControlType.IDENTITY_MANAGER_MANDATORY.equals(getModelObject().getPropagation())) {
                    return false;
                }
                if (!passwordAccountDto.isMidpoint() && midpointAccountSelected.getObject() && passwordAccountDto.isPasswordOutbound()) {
                    passwordAccountDto.setSelected(true);
                    return false;
                }
                return true;
            };
        }

        @Override
        protected void processBehaviourOfCheckBox(IsolatedCheckBoxPanel check, IModel<PasswordAccountDto> rowModel) {
            super.processBehaviourOfCheckBox(check, rowModel);
            IModel<String> titleModel = () -> {
                PasswordAccountDto passwordAccountDto = rowModel.getObject();
                if (!getEnabled(rowModel).getObject()) {
                    String key;
                    if (!passwordAccountDto.isMidpoint() && !passwordAccountDto.isPasswordCapabilityEnabled()) {
                        key = "ChangePasswordPanel.legendMessage.no.password.capability";
                    } else {
                        key = "ChangePasswordPanel.legendMessage.policy";
                    }
                    return createStringResource(key).getString();
                }
                return "";
            };
            check.add(AttributeAppender.append("title", titleModel));
        }

        @Override
        protected void onUpdateRow(AjaxRequestTarget target, DataTable table, IModel<PasswordAccountDto> rowModel, IModel<Boolean> selected) {
            super.onUpdateRow(target, table, rowModel, selected);
            if (rowModel.getObject().isMidpoint()) {
                table.visitChildren(IsolatedCheckBoxPanel.class, (IVisitor<IsolatedCheckBoxPanel, IsolatedCheckBoxPanel>) (panel, iVisit) -> {
                    target.add(panel);
                });
            }
        }
    });
    columns.add(new AbstractColumn<PasswordAccountDto, String>(createStringResource("ChangePasswordPanel.name")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<PasswordAccountDto>> item, String componentId, final IModel<PasswordAccountDto> rowModel) {
            item.add(new Label(componentId, new IModel<>() {

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    PasswordAccountDto dto = rowModel.getObject();
                    return dto.getDisplayName();
                }
            }));
        }
    });
    columns.add(new AbstractColumn<PasswordAccountDto, String>(createStringResource("ChangePasswordPanel.resourceName")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<PasswordAccountDto>> item, String componentId, final IModel<PasswordAccountDto> rowModel) {
            IModel<String> helpModel = () -> {
                String title = "";
                if (!rowModel.getObject().isMidpoint() && !rowModel.getObject().isPasswordCapabilityEnabled()) {
                    title = createStringResource("ChangePasswordPanel.legendMessage.no.password.capability").getString();
                }
                if (rowModel.getObject().isMaintenanceState()) {
                    title = title + (StringUtils.isEmpty(title) ? "" : " ") + createStringResource("ChangePasswordPanel.legendMessage.maintenance").getString();
                }
                return title;
            };
            item.add(new LabelWithHelpPanel(componentId, new IModel<>() {

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    PasswordAccountDto dto = rowModel.getObject();
                    return dto.getResourceName();
                }
            }) {

                @Override
                protected IModel<String> getHelpModel() {
                    return helpModel;
                }
            });
        }
    });
    IconColumn enabled = new IconColumn<PasswordAccountDto>(createStringResource("ChangePasswordPanel.enabled")) {

        @Override
        protected DisplayType getIconDisplayType(IModel<PasswordAccountDto> rowModel) {
            String cssClass = "fa fa-question text-info";
            String tooltip = "ActivationStatusType.null";
            if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().isEnabled() != null) {
                if (rowModel.getObject().isEnabled()) {
                    cssClass = GuiStyleConstants.CLASS_APPROVAL_OUTCOME_ICON_APPROVED_COLORED;
                    tooltip = "ActivationStatusType.ENABLED";
                } else {
                    cssClass = GuiStyleConstants.CLASS_APPROVAL_OUTCOME_ICON_REJECTED_COLORED;
                    tooltip = "ActivationStatusType.DISABLED";
                }
            }
            return GuiDisplayTypeUtil.createDisplayType(cssClass + " fa-fw fa-lg", "", createStringResource(tooltip).getString());
        }

        @Override
        public String getCssClass() {
            return "col-lg-1";
        }
    };
    columns.add(enabled);
    columns.add(new AbstractColumn<PasswordAccountDto, String>(createStringResource("ChangePasswordPanel.passwordValidation")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<PasswordAccountDto>> cellItem, String componentId, IModel<PasswordAccountDto> rowModel) {
            IModel<List<StringLimitationResult>> limitationsModel = () -> {
                String policyOid = rowModel.getObject().getPasswordValuePolicyOid();
                if (StringUtils.isEmpty(policyOid) || !getModelObject().getPasswordPolicies().containsKey(policyOid)) {
                    return new ArrayList<>();
                }
                if (limitationsByPolicyOid.containsKey(policyOid)) {
                    return limitationsByPolicyOid.get(policyOid);
                }
                ValuePolicyType policyType = getModelObject().getPasswordPolicies().get(policyOid);
                PrismObject<? extends ObjectType> object = rowModel.getObject().getObject();
                List<StringLimitationResult> limitations = getPasswordPanel().getLimitationsForActualPassword(policyType, object);
                limitationsByPolicyOid.put(policyOid, limitations);
                return limitations;
            };
            PasswordPolicyValidationPanel validationPanel = new PasswordPolicyValidationPanel(componentId, limitationsModel);
            validationPanel.add(new VisibleEnableBehaviour() {

                @Override
                public boolean isVisible() {
                    return !limitationsModel.getObject().isEmpty();
                }
            });
            cellItem.add(validationPanel);
        }

        @Override
        public String getCssClass() {
            return "col-lg-2";
        }
    });
    columns.add(new AbstractColumn<PasswordAccountDto, String>(createStringResource("ChangePasswordPanel.propagationResult")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<PasswordAccountDto>> cellItem, String componentId, IModel<PasswordAccountDto> rowModel) {
            LoadableModel<OperationResult> resultStatusModel = new LoadableModel<OperationResult>() {

                @Override
                protected OperationResult load() {
                    if (getModelObject().getProgress() == null || getModelObject().getProgress().getProgressReportActivities().isEmpty()) {
                        return null;
                    }
                    for (ProgressReportActivityDto progressActivity : getModelObject().getProgress().getProgressReportActivities()) {
                        if (rowModel.getObject().isSelected() && progressActivity.getStatus() != null && rowModel.getObject().isMidpoint() && (ProgressInformation.ActivityType.FOCUS_OPERATION.equals(progressActivity.getActivityType()) || (ProgressInformation.ActivityType.PROJECTOR.equals(progressActivity.getActivityType()) && !OperationResultStatusType.SUCCESS.equals(progressActivity.getStatus())))) {
                            return progressActivity.getOperationResult();
                        } else if (progressActivity.getStatus() != null && !rowModel.getObject().isMidpoint() && ProgressInformation.ActivityType.RESOURCE_OBJECT_OPERATION.equals(progressActivity.getActivityType()) && progressActivity.getResourceOperationResultList() != null && !progressActivity.getResourceOperationResultList().isEmpty()) {
                            String resourceOid = rowModel.getObject().getResourceOid();
                            if (StringUtils.isNotEmpty(resourceOid) && progressActivity.getResourceShadowDiscriminator() != null && resourceOid.equals(progressActivity.getResourceShadowDiscriminator().getResourceOid())) {
                                return progressActivity.getOperationResult();
                            }
                        }
                    }
                    return new OperationResult("Empty result");
                }
            };
            ColumnResultPanel resultPanel = new ColumnResultPanel(componentId, resultStatusModel) {

                @Override
                protected boolean isProjectionResult() {
                    return !rowModel.getObject().isMidpoint();
                }

                @Override
                protected DisplayType getDisplayForEmptyResult() {
                    String policyOid = rowModel.getObject().getPasswordValuePolicyOid();
                    if (StringUtils.isNotEmpty(policyOid) && ChangePasswordPanel.this.getModelObject().getPasswordPolicies().containsKey(policyOid)) {
                        if (limitationsByPolicyOid.get(policyOid) != null) {
                            var ref = new Object() {

                                boolean result = true;
                            };
                            limitationsByPolicyOid.get(policyOid).forEach((limit) -> {
                                if (ref.result && !limit.isSuccess()) {
                                    ref.result = false;
                                }
                            });
                            if (!ref.result && rowModel.getObject().isSelected()) {
                                return GuiDisplayTypeUtil.createDisplayType("fa-fw fa fa-times-circle text-muted fa-lg", "", createStringResource("ChangePasswordPanel.result.validationError").getString());
                            }
                        }
                    }
                    return null;
                }
            };
            resultPanel.setOutputMarkupId(true);
            cellItem.add(resultPanel);
        }

        @Override
        public String getCssClass() {
            return "col-lg-2";
        }
    });
    return columns;
}
Also used : PageSelfCredentials(com.evolveum.midpoint.web.page.self.PageSelfCredentials) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) StringUtils(org.apache.commons.lang3.StringUtils) AuthUtil(com.evolveum.midpoint.authentication.api.util.AuthUtil) WebModelServiceUtils(com.evolveum.midpoint.gui.api.util.WebModelServiceUtils) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) Label(org.apache.wicket.markup.html.basic.Label) ProgressReportActivityDto(com.evolveum.midpoint.web.component.progress.ProgressReportActivityDto) Model(org.apache.wicket.model.Model) LabelWithHelpPanel(com.evolveum.midpoint.gui.api.component.LabelWithHelpPanel) WebComponentUtil(com.evolveum.midpoint.gui.api.util.WebComponentUtil) ResourceTypeUtil(com.evolveum.midpoint.schema.util.ResourceTypeUtil) Task(com.evolveum.midpoint.task.api.Task) AttributeModifier(org.apache.wicket.AttributeModifier) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) PropertyModel(org.apache.wicket.model.PropertyModel) Item(org.apache.wicket.markup.repeater.Item) PasswordAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto) MyPasswordsDto(com.evolveum.midpoint.web.page.admin.home.dto.MyPasswordsDto) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ResourceObjectDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectDefinition) java.util(java.util) GuiDisplayTypeUtil(com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil) com.evolveum.midpoint.web.component.data.column(com.evolveum.midpoint.web.component.data.column) com.evolveum.midpoint.xml.ns._public.common.common_3(com.evolveum.midpoint.xml.ns._public.common.common_3) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Trace(com.evolveum.midpoint.util.logging.Trace) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) CollectionUtils(org.apache.commons.collections4.CollectionUtils) GuiStyleConstants(com.evolveum.midpoint.gui.api.GuiStyleConstants) CredentialsCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CredentialsCapabilityType) StringLimitationResult(com.evolveum.midpoint.model.api.validator.StringLimitationResult) CapabilityUtil(com.evolveum.midpoint.schema.CapabilityUtil) IVisitor(org.apache.wicket.util.visit.IVisitor) Selectable(com.evolveum.midpoint.web.component.util.Selectable) DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) PasswordTextField(org.apache.wicket.markup.html.form.PasswordTextField) PrismObject(com.evolveum.midpoint.prism.PrismObject) PasswordPanel(com.evolveum.midpoint.gui.api.component.password.PasswordPanel) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) LoggingUtils(com.evolveum.midpoint.util.logging.LoggingUtils) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) PrismReference(com.evolveum.midpoint.prism.PrismReference) ProgressInformation(com.evolveum.midpoint.model.api.ProgressInformation) ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) TraceManager(com.evolveum.midpoint.util.logging.TraceManager) DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) LabelWithHelpPanel(com.evolveum.midpoint.gui.api.component.LabelWithHelpPanel) Label(org.apache.wicket.markup.html.basic.Label) StringLimitationResult(com.evolveum.midpoint.model.api.validator.StringLimitationResult) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PasswordAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) IModel(org.apache.wicket.model.IModel) IVisitor(org.apache.wicket.util.visit.IVisitor) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ProgressReportActivityDto(com.evolveum.midpoint.web.component.progress.ProgressReportActivityDto) PrismObject(com.evolveum.midpoint.prism.PrismObject)

Example 5 with PasswordAccountDto

use of com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto in project midpoint by Evolveum.

the class PageAbstractSelfCredentials method getSelectedAccountsList.

protected List<PasswordAccountDto> getSelectedAccountsList() {
    List<PasswordAccountDto> passwordAccountDtos = getPasswordDto().getAccounts();
    List<PasswordAccountDto> selectedAccountList = new ArrayList<>();
    if (getPasswordDto().getPropagation() != null && getPasswordDto().getPropagation().equals(CredentialsPropagationUserControlType.MAPPING)) {
        selectedAccountList.addAll(passwordAccountDtos);
    } else {
        boolean midpointAccountSelected = false;
        List<PasswordAccountDto> selectedWithOutbound = new ArrayList<>();
        for (PasswordAccountDto passwordAccountDto : passwordAccountDtos) {
            if (passwordAccountDto.isMidpoint()) {
                midpointAccountSelected = passwordAccountDto.isSelected();
            }
            if (passwordAccountDto.isSelected()) {
                if (!passwordAccountDto.isPasswordOutbound()) {
                    selectedAccountList.add(passwordAccountDto);
                } else {
                    selectedWithOutbound.add(passwordAccountDto);
                }
            }
        }
        if (!midpointAccountSelected) {
            selectedAccountList.addAll(selectedWithOutbound);
        }
    }
    return selectedAccountList;
}
Also used : ArrayList(java.util.ArrayList) PasswordAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto)

Aggregations

PasswordAccountDto (com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto)9 MyPasswordsDto (com.evolveum.midpoint.web.page.admin.home.dto.MyPasswordsDto)5 PrismReference (com.evolveum.midpoint.prism.PrismReference)4 PasswordPanel (com.evolveum.midpoint.gui.api.component.password.PasswordPanel)3 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 ResourceObjectDefinition (com.evolveum.midpoint.schema.processor.ResourceObjectDefinition)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 Task (com.evolveum.midpoint.task.api.Task)3 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)3 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)3 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)3 AttributeModifier (org.apache.wicket.AttributeModifier)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 Label (org.apache.wicket.markup.html.basic.Label)3 PasswordTextField (org.apache.wicket.markup.html.form.PasswordTextField)3 AuthUtil (com.evolveum.midpoint.authentication.api.util.AuthUtil)2 GuiStyleConstants (com.evolveum.midpoint.gui.api.GuiStyleConstants)2 BasePanel (com.evolveum.midpoint.gui.api.component.BasePanel)2