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

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


                new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        FormValidation validation = form.validate();
                        if (!validation.hasErrors()) {
                            RoleAssignment roleAssignment = new RoleAssignment(principalItem.getValue());
                            roleAssignment.setRealm(realmItem.getValue());
                            if (Console.CONSTANTS.common_label_include().equals(includeExcludeItem.getValue())) {
                                roleAssignment.addRoles(rolesItem.getValue());
                            } else if (Console.CONSTANTS.common_label_exclude().equals(includeExcludeItem.getValue())) {
                                roleAssignment.addExcludes(rolesItem.getValue());
                            }
                            presenter.addRoleAssignment(roleAssignment);
                        }
                    }
                },
View Full Code Here


                type == Principal.Type.GROUP ? Console.CONSTANTS.common_label_group() : Console.CONSTANTS
                        .common_label_user()) {
            @Override
            public String asString() {
                StringBuilder builder = new StringBuilder();
                RoleAssignment assignment = getValue();
                if (assignment != null) {
                    builder.append(assignment.getPrincipal().getName());
                    if (assignment.getRealm() != null) {
                        builder.append("@").append(assignment.getRealm());
                    }
                }
                return builder.toString();
            }
        };
        principalItem.setEnabled(false);
        includeExcludeFormItem = new IncludeExcludeFormItem("n/a", Console.CONSTANTS.common_label_roles());

        form.setFields(principalItem, includeExcludeFormItem);
        //        form.setFieldsInGroup(Console.CONSTANTS.common_label_advanced(), new DisclosureGroupRenderer(), excludesItem);
        form.setEnabled(false);
        form.setToolsCallback(new FormCallback() {
            @Override
            public void onSave(final Map changeset) {
                RoleAssignment edited = form.getEditedEntity();
                if (edited != null) {
                    // create a new role assignment to calculate the include / exclude diffs
                    Map<IncludeExcludeFormItem.Type, Set<Role>> includesExcludes = includeExcludeFormItem.getValue();
                    RoleAssignment newRoleAssignment = new RoleAssignment(edited.getPrincipal());
                    newRoleAssignment.setRealm(edited.getRealm());
                    newRoleAssignment.addRoles(includesExcludes.get(INCLUDE));
                    newRoleAssignment.addExcludes(includesExcludes.get(EXCLUDE));
                    presenter.saveRoleAssignment(newRoleAssignment, edited);
                }
            }

            @Override
View Full Code Here

            @Override
            public void onSelectionChange(final SelectionChangeEvent event) {
                Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                    @Override
                    public void execute() {
                        RoleAssignment selected = selectionModel.getSelectedObject();
                        updateFormFields(selected);
                    }
                });
            }
        });
View Full Code Here

                new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        FormValidation validation = form.validate();
                        if (!validation.hasErrors()) {
                            RoleAssignment assignment = form.getUpdatedEntity();
                            // The form cannot handle enums...
                            assignment.setRoles(rolesItem.getValue());
                            presenter.addRoleAssignment(assignment);
                        }
                    }
                },
                new ClickHandler() {
View Full Code Here

        form.setFields(rolesItem);
        form.setEnabled(false);
        form.setToolsCallback(new FormCallback() {
            @Override
            public void onSave(final Map changeset) {
                RoleAssignment assignment = form.getUpdatedEntity();
                // 'principal' was not part of the form
                assignment.setPrincipal(form.getEditedEntity().getPrincipal());
                // The form cannot handle enums
                assignment.setRoles(rolesItem.getValue());
                presenter.saveRoleAssignment(assignment, removedRoles(assignment));
            }

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

            public void onSelectionChange(final SelectionChangeEvent event) {
                Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                    @Override
                    public void execute() {
                        rolesBefore.clear();
                        RoleAssignment assignment = selectionModel.getSelectedObject();
                        if (assignment != null) {
                            rolesItem.setRoleAssignment(assignment);
                            for (Role role : assignment.getRoles()) {
                                rolesBefore.put(role.getName(), role);
                            }
                            form.edit(assignment);
                        } else {
                            form.clearValues();
View Full Code Here

                            Principal principal = principalItem.getValue();
                            if (realm != null && realm.length() != 0) {
                                principal = new Principal(principal.getId() + "@" + realm, principal.getName(),
                                        principal.getType());
                            }
                            RoleAssignment roleAssignment = new RoleAssignment(principal);
                            roleAssignment.setRealm(realm);
                            if ("Include".equals(includeExcludeItem.getValue())) {
                                roleAssignment.addRoles(rolesItem.getValue());
                            } else if ("Exclude".equals(includeExcludeItem.getValue())) {
                                roleAssignment.addExcludes(rolesItem.getValue());
                            }
                            presenter.addRoleAssignment(roleAssignment);
                        }
                    }
                },
View Full Code Here

    public Widget asWidget() {
        principalItem = new ReadOnlyItem<RoleAssignment>("principal", type == Principal.Type.GROUP ? "Group" : "User") {
            @Override
            public String asString() {
                StringBuilder builder = new StringBuilder();
                RoleAssignment assignment = getValue();
                if (assignment != null) {
                    builder.append(assignment.getPrincipal().getName());
                    if (assignment.getRealm() != null) {
                        builder.append("@").append(assignment.getRealm());
                    }
                }
                return builder.toString();
            }
        };
        principalItem.setEnabled(false);
        includeExcludeFormItem = new IncludeExcludeFormItem("n/a", "Roles");

        form.setFields(principalItem, includeExcludeFormItem);
        //        form.setFieldsInGroup(Console.CONSTANTS.common_label_advanced(), new DisclosureGroupRenderer(), excludesItem);
        form.setEnabled(false);
        form.setToolsCallback(new FormCallback() {
            @Override
            public void onSave(final Map changeset) {
                RoleAssignment edited = form.getEditedEntity();
                if (edited != null) {
                    // create a new role assignment to calculate the include / exclude diffs
                    Map<IncludeExcludeFormItem.Type, Set<Role>> includesExcludes = includeExcludeFormItem.getValue();
                    RoleAssignment newRoleAssignment = new RoleAssignment(edited.getPrincipal());
                    newRoleAssignment.setRealm(edited.getRealm());
                    newRoleAssignment.addRoles(includesExcludes.get(INCLUDE));
                    newRoleAssignment.addExcludes(includesExcludes.get(EXCLUDE));
                    presenter.saveRoleAssignment(newRoleAssignment, edited);
                }
            }

            @Override
View Full Code Here

            @Override
            public void onSelectionChange(final SelectionChangeEvent event) {
                Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                    @Override
                    public void execute() {
                        RoleAssignment selected = selectionModel.getSelectedObject();
                        updateFormFields(selected);
                    }
                });
            }
        });
View Full Code Here

    public Widget asWidget() {
        principalItem = new ReadOnlyItem<RoleAssignment>("principal", type == Principal.Type.GROUP ? "Group" : "User") {
            @Override
            public String asString() {
                StringBuilder builder = new StringBuilder();
                RoleAssignment assignment = getValue();
                if (assignment != null) {
                    builder.append(assignment.getPrincipal().getName());
                    if (assignment.getRealm() != null) {
                        builder.append("@").append(assignment.getRealm());
                    }
                }
                return builder.toString();
            }
        };
        principalItem.setEnabled(false);
        includeExcludeFormItem = new IncludeExcludeFormItem("n/a", "Roles");

        form.setFields(principalItem, includeExcludeFormItem);
        //        form.setFieldsInGroup(Console.CONSTANTS.common_label_advanced(), new DisclosureGroupRenderer(), excludesItem);
        form.setEnabled(false);
        form.setToolsCallback(new FormCallback() {
            @Override
            public void onSave(final Map changeset) {
                RoleAssignment edited = form.getEditedEntity();
                if (edited != null) {
                    // create a new role assignment to calculate the include / exclude diffs
                    Map<IncludeExcludeFormItem.Type, Set<Role>> includesExcludes = includeExcludeFormItem.getValue();
                    RoleAssignment newRoleAssignment = new RoleAssignment(edited.getPrincipal());
                    newRoleAssignment.setRealm(edited.getRealm());
                    newRoleAssignment.addRoles(includesExcludes.get(INCLUDE));
                    newRoleAssignment.addExcludes(includesExcludes.get(EXCLUDE));
                    presenter.saveRoleAssignment(newRoleAssignment, edited);
                }
            }

            @Override
View Full Code Here

TOP

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

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.