Package org.apache.syncope.common.to

Examples of org.apache.syncope.common.to.RoleTO


        add(form);
    }

    protected void submitAction(final AjaxRequestTarget target, final Form form) {
        final RoleTO roleTO = (RoleTO) form.getDefaultModelObject();
        final List<String> entitlementList = new ArrayList<String>(rolePanel.getSelectedEntitlements());
        roleTO.setEntitlements(entitlementList);

        final RoleTO result;
        if (createFlag) {
            result = roleRestClient.create(roleTO);
        } else {
            RoleMod roleMod = AttributableOperations.diff(roleTO, originalRoleTO);
View Full Code Here


            for (MembershipTO memb : template.getMemberships()) {
                checkJexl(memb, sce);
            }
        }
        if (taskTO.getRoleTemplate() != null) {
            RoleTO template = taskTO.getRoleTemplate();

            if (StringUtils.isNotBlank(template.getName()) && !jexlUtil.isExpressionValid(template.getName())) {
                sce.addElement("Invalid JEXL: " + template.getName());
            }

            checkJexl(template, sce);
        }
        if (!sce.isEmpty()) {
View Full Code Here

    @SuppressWarnings("unchecked")
    @Transactional(readOnly = true)
    public RoleTO getRoleTO(final SyncopeRole role) {
        connObjectUtil.retrieveVirAttrValues(role, AttributableUtil.getInstance(AttributableType.ROLE));

        RoleTO roleTO = new RoleTO();
        roleTO.setId(role.getId());
        roleTO.setName(role.getName());

        roleTO.setInheritOwner(role.isInheritOwner());

        roleTO.setInheritAttributes(role.isInheritAttributes());
        roleTO.setInheritDerivedAttributes(role.isInheritDerivedAttributes());
        roleTO.setInheritVirtualAttributes(role.isInheritVirtualAttributes());

        roleTO.setInheritPasswordPolicy(role.isInheritPasswordPolicy());
        roleTO.setInheritAccountPolicy(role.isInheritAccountPolicy());

        if (role.getParent() != null) {
            roleTO.setParent(role.getParent().getId());
        }

        if (role.getUserOwner() != null) {
            roleTO.setUserOwner(role.getUserOwner().getId());
        }
        if (role.getRoleOwner() != null) {
            roleTO.setRoleOwner(role.getRoleOwner().getId());
        }

        // -------------------------
        // Retrieve all [derived/virtual] attributes (inherited and not)
        // -------------------------
        final List<RAttr> allAttributes = role.findInheritedAttributes();
        allAttributes.addAll((List<RAttr>) role.getAttributes());

        final List<RDerAttr> allDerAttributes = role.findInheritedDerivedAttributes();
        allDerAttributes.addAll((List<RDerAttr>) role.getDerivedAttributes());

        final List<RVirAttr> allVirAttributes = role.findInheritedVirtualAttributes();
        allVirAttributes.addAll((List<RVirAttr>) role.getVirtualAttributes());
        // -------------------------

        fillTO(roleTO, allAttributes, allDerAttributes, allVirAttributes, role.getResources());

        for (Entitlement entitlement : role.getEntitlements()) {
            roleTO.addEntitlement(entitlement.getName());
        }

        roleTO.setPasswordPolicy(role.getPasswordPolicy() == null
                ? null
                : role.getPasswordPolicy().getId());
        roleTO.setAccountPolicy(role.getAccountPolicy() == null
                ? null
                : role.getAccountPolicy().getId());

        return roleTO;
    }
View Full Code Here

            wrapper.setType(searchCond.getAttributeCond().getType());
            wrapper.setFilterValue(searchCond.getAttributeCond().getExpression());
        }
        if (searchCond.getMembershipCond() != null) {
            wrapper.setFilterType(SearchCondWrapper.FilterType.MEMBERSHIP);
            RoleTO role = new RoleTO();
            role.setId(searchCond.getMembershipCond().getRoleId());
            role.setName(searchCond.getMembershipCond().getRoleName());
            wrapper.setFilterName(role.getDisplayName());
        }
        if (searchCond.getResourceCond() != null) {
            wrapper.setFilterType(SearchCondWrapper.FilterType.RESOURCE);
            wrapper.setFilterName(searchCond.getResourceCond().getResourceName());
        }
View Full Code Here

        switch (type) {
            case USER:
                result = (T) new UserTO();
                break;
            case ROLE:
                result = (T) new RoleTO();
                break;
            case MEMBERSHIP:
                result = (T) new MembershipTO();
                break;
        }
View Full Code Here

            private static final long serialVersionUID = 7137658050662575546L;

            @Override
            protected Component newContentComponent(final String id, final IModel<DefaultMutableTreeNode> node) {
                final DefaultMutableTreeNode treeNode = node.getObject();
                final RoleTO roleTO = (RoleTO) treeNode.getUserObject();

                return new Folder<DefaultMutableTreeNode>(id, TreeRolePanel.this.tree, node) {

                    private static final long serialVersionUID = 9046323319920426493L;

                    @Override
                    protected boolean isClickable() {
                        return true;
                    }

                    @Override
                    protected IModel<?> newLabelModel(final IModel<DefaultMutableTreeNode> model) {
                        return new Model<String>(roleTO.getDisplayName());
                    }

                    @Override
                    protected void onClick(final AjaxRequestTarget target) {
                        super.onClick(target);

                        send(getPage(), Broadcast.BREADTH, new TreeNodeClickUpdate(target, roleTO.getId()));
                    }
                };
            }
        };
        tree.add(new WindowsTheme());
View Full Code Here

        inverse = false;
    }

    @Override
    public boolean add(final DefaultMutableTreeNode node) {
        RoleTO roleTO = (RoleTO) node.getUserObject();
        if (inverse) {
            return ids.remove(roleTO.getId());
        } else {
            return ids.add(roleTO.getId());
        }
    }
View Full Code Here

    }

    @Override
    public boolean remove(final Object object) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) object;
        RoleTO roleTO = (RoleTO) node.getUserObject();
        if (inverse) {
            return ids.add(roleTO.getId());
        } else {
            return ids.remove(roleTO.getId());
        }
    }
View Full Code Here

    }

    @Override
    public boolean contains(final Object object) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) object;
        RoleTO roleTO = (RoleTO) node.getUserObject();
        if (inverse) {
            return !ids.contains(roleTO.getId());
        } else {
            return ids.contains(roleTO.getId());
        }
    }
View Full Code Here

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        RoleTO roleTO = new RoleTO();
                        roleTO.setParent(idRole);
                        RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                        return form;
                    }
                });

                window.show(target);
            }
        };

        MetaDataRoleAuthorizationStrategy.authorize(createRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles",
                "create"));

        createRoleLink.setOutputMarkupId(true);
        fragment.add(createRoleLink);

        if (idRole != 0) {
            final AjaxLink updateRoleLink = new ClearIndicatingAjaxLink("updateRoleLink", pageRef) {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                protected void onClickInternal(final AjaxRequestTarget target) {
                    window.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            RoleTO roleTO = restClient.read(idRole);
                            RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                            return form;
                        }
                    });

                    window.show(target);
                }
            };

            MetaDataRoleAuthorizationStrategy.authorize(updateRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles(
                    "Roles", "read"));

            updateRoleLink.setOutputMarkupId(true);
            fragment.add(updateRoleLink);

            final AjaxLink dropRoleLink = new IndicatingDeleteOnConfirmAjaxLink("dropRoleLink", pageRef) {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                protected void onClickInternal(final AjaxRequestTarget target) {
                    try {
                        final RoleTO roleTO = (RoleTO) restClient.delete(idRole);

                        ((Roles) pageRef.getPage()).setModalResult(true);

                        window.setPageCreator(new ModalWindow.PageCreator() {
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.to.RoleTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.