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

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


                // Skip the local user
                return null;
            }

            Principal.Type type = Principal.Type.valueOf(node.get("type").asString());
            Principal principal = new Principal(type, name);
            principals.add(principal);

            String realm = null;
            if (node.hasDefined("realm")) {
                realm = node.get("realm").asString();
View Full Code Here


        });
        wrapper = new InputElementWrapper(suggestBox, this);
    }

    private void parseValue(final String name) {
        Principal principal = null;
        if (name != null && name.trim().length() != 0) {
            principal = cache.get(name);
            if (principal == null) {
                // create a new principal
                principal = new Principal(type, name);
                cache.put(principal.getName(), principal);
            }
        }
        setValue(principal);
    }
View Full Code Here

        Principal.Type type = Principal.Type.valueOf(principalNode.get("type").asString());
        String realm = null;
        if (principalNode.hasDefined("realm")) {
            realm = principalNode.get("realm").asString();
        }
        Principal principal = principals.lookup(type, principalName);
        if (principal != null) {
            return new RoleAssignment.PrincipalRealmTupel(principal, realm);
        }
        return null;
    }
View Full Code Here

                            for (Principal principal : perRole) {
                                meltingPot.put(principal.getName(), principal);
                            }
                        }
                        for (Iterator<Principal> iterator = meltingPot.values().iterator(); iterator.hasNext(); ) {
                            Principal principal = iterator.next();
                            excludes.append(principal.getName());
                            if (iterator.hasNext()) {
                                excludes.append(", ");
                            }
                        }
                    }
View Full Code Here

                RoleAssignment.ManagementModel managementModel = new RoleAssignment.ManagementModel(role);
                ModelNode assignmentNode = property.getValue();
                if (assignmentNode.hasDefined("include")) {
                    List<Property> inclusions = assignmentNode.get("include").asPropertyList();
                    for (Property inclusion : inclusions) {
                        Principal principal = mapPrincipal(principals, inclusion.getValue());
                        if (principal != null) {
                            managementModel.include(principal);
                        }
                    }
                    if (managementModel.getIncludes().isEmpty()) {
                        // if the only inclusion was the local user, the list is empty and mapping can be skipped
                        add = false;
                    }
                } else {
                    // don't add this model, but goon so that principals in "exclude" will get extracted
                    add = false;
                }
                if (assignmentNode.hasDefined("exclude")) {
                    List<Property> exclusions = assignmentNode.get("exclude").asPropertyList();
                    for (Property exclusion : exclusions) {
                        Principal principal = mapPrincipal(principals, exclusion.getValue());
                        if (principal != null && principal.getType() == USER) {
                            // exclude only users (see constraints)
                            managementModel.exclude(principal);
                        }
                    }
                }
View Full Code Here

            String name = node.get("name").asString();
            if (LOCAL_USERNAME.equals(name)) {
                // Skip the local user
                return null;
            }
            Principal principal = beanFactory.principal().as();
            principal.setName(name);
            if (node.hasDefined("realm")) {
                principal.setRealm(node.get("realm").asString());
            }
            PrincipalType type = PrincipalType.valueOf(node.get("type").asString());
            principal.setType(type);
            principals.add(principal);
            return principal;
        }
View Full Code Here

        });
        wrapper = new InputElementWrapper(suggestBox, this);
    }

    private void parseValue(final String name) {
        Principal principal = null;
        if (name != null && name.trim().length() != 0) {
            principal = cache.get(name);
            if (principal == null) {
                // create a new principal
                principal = beanFactory.principal().as();
                principal.setName(name);
                principal.setType(type);
                cache.put(principal.getName(), principal);
            }
        }
        setValue(principal);
    }
View Full Code Here

    private void parseValue(final String newValue) {
        ArrayList<Principal> list = new ArrayList<Principal>();
        if (newValue != null && newValue.trim().length() != 0) {
            String[] lines = newValue.split("\n");
            for (String line : lines) {
                Principal principal = cache.get(line);
                if (principal != null) {
                    list.add(principal);
                } else {
                    // create a new principal
                    principal = beanFactory.principal().as();
                    principal.setName(line);
                    principal.setType(type);
                    list.add(principal);
                    cache.put(principal.getName(), principal);
                }
            }
        }
        setValue(list);
    }
View Full Code Here

    public void setValue(final List<Principal> value) {
        this.value.clear();
        this.value.addAll(value);
        StringBuilder builder = new StringBuilder();
        for (Iterator<Principal> iterator = value.iterator(); iterator.hasNext(); ) {
            Principal principal = iterator.next();
            builder.append(principal.getName());
            if (iterator.hasNext()) {
                builder.append("\n");
            }
        }
View Full Code Here

    }

    public String asString() {
        StringBuilder builder = new StringBuilder("[");
        for (Iterator<Principal> iterator = value.iterator(); iterator.hasNext(); ) {
            Principal principal = iterator.next();
            builder.append(principal.getName());
            if (iterator.hasNext()) {
                builder.append(", ");
            }
        }
        builder.append("]");
View Full Code Here

TOP

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

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.