Package org.jboss.as.console.client.administration.role.model

Examples of org.jboss.as.console.client.administration.role.model.ScopedRole


            });
        }

        private void addScopedRole(final Roles roles, final Property property, final String scopeName,
                final ScopeType type) {
            ScopedRole scopedRole = beanFactory.scopedRole().as();
            scopedRole.setName(property.getName());
            scopedRole.setType(type);
            ModelNode node = property.getValue();
            String baseRoleName = node.get("base-role").asString();
            scopedRole.setBaseRole(StandardRole.fromString(baseRoleName));

            List<String> scope = new ArrayList<String>();
            List<ModelNode> scopeNodes = node.get(scopeName).asList();
            for (ModelNode scopeNode : scopeNodes) {
                scope.add(scopeNode.asString());
            }
            scopedRole.setScope(scope);
            roles.add(scopedRole);
        }
View Full Code Here


        form.setFields(nameItem, baseRoleItem, typeItem, scopeItem);
        form.setEnabled(false);
        form.setToolsCallback(new FormCallback() {
            @Override
            public void onSave(final Map changeset) {
                ScopedRole scopedRole = form.getUpdatedEntity();
                // The form cannot handle enums...
                scopedRole.setBaseRole(baseRoleItem.getValue());
                scopedRole.setType(typeItem.getValue());
                presenter.saveScopedRole(scopedRole, form.getChangedValues());
            }

            @Override
            public void onCancel(final Object entity) {
View Full Code Here

            @Override
            public void onSelectionChange(final SelectionChangeEvent event) {
                Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                    @Override
                    public void execute() {
                        ScopedRole role = selectionModel.getSelectedObject();
                        if (role != null) {
                            updateScope(role.getType());
                            form.edit(role);
                        } else {
                            form.clearValues();
                        }
                    }
View Full Code Here

                scopeItem.setChoices(hosts);
            } else if (type == ScopeType.serverGroup) {
                scopeItem.setChoices(serverGroups);
            }
            // restore selection
            ScopedRole entity = form.getEditedEntity();
            if (entity != null) {
                scopeItem.setValue(entity.getScope());
            }
        }
    }
View Full Code Here

                new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        FormValidation validation = form.validate();
                        if (!validation.hasErrors()) {
                            ScopedRole scopedRole = form.getUpdatedEntity();
                            // The form cannot handle enums...
                            scopedRole.setBaseRole(baseRoleItem.getValue());
                            scopedRole.setType(typeItem.getValue());
                            presenter.addScopedRole(scopedRole);
                        }
                    }
                },
                new ClickHandler() {
View Full Code Here

            scopeItem.setChoices(hosts);
        } else if (type == ScopeType.serverGroup) {
            scopeItem.setChoices(serverGroups);
        }
        // restore selection
        ScopedRole entity = form.getEditedEntity();
        if (entity != null) {
            scopeItem.setValue(entity.getScope());
        }
    }
View Full Code Here

    private static void asSafeHtml(final SafeHtmlBuilder builder, final Role role) {
        if (role instanceof StandardRole) {
            builder.append(TEMPLATES.role(role.getName()));
        } else if (role instanceof ScopedRole) {
            ScopedRole scopedRole = (ScopedRole) role;
            StringBuilder scopes = new StringBuilder();
            for (Iterator<String> scopeIter = scopedRole.getScope().iterator(); scopeIter.hasNext(); ) {
                String scope = scopeIter.next();
                scopes.append(scope);
                if (scopeIter.hasNext()) {
                    scopes.append(", ");
                }
            }
            builder.append(
                    TEMPLATES.scopedRole(role.getName(), scopedRole.getBaseRole().name(), scopes.toString()));
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.console.client.administration.role.model.ScopedRole

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.