Search in sources :

Example 1 with OnJoinPermissionOperationName

use of com.hazelcast.config.OnJoinPermissionOperationName in project hazelcast by hazelcast.

the class YamlMemberDomConfigProcessor method handleSecurityPermissions.

@SuppressWarnings({ "checkstyle:npathcomplexity", "checkstyle:methodlength" })
protected void handleSecurityPermissions(Node node) {
    String onJoinOp = getAttribute(node, "on-join-operation");
    if (onJoinOp != null) {
        OnJoinPermissionOperationName onJoinPermissionOperation = OnJoinPermissionOperationName.valueOf(upperCaseInternal(onJoinOp));
        config.getSecurityConfig().setOnJoinPermissionOperation(onJoinPermissionOperation);
    }
    Iterable<Node> nodes = childElements(node);
    for (Node child : nodes) {
        String nodeName = cleanNodeName(child);
        if (matches("on-join-operation", nodeName)) {
            continue;
        }
        nodeName = matches("all", nodeName) ? nodeName + "-permissions" : nodeName + "-permission";
        PermissionType type = PermissionConfig.PermissionType.getType(nodeName);
        if (type == null) {
            throw new InvalidConfigurationException("Security permission type is not valid " + nodeName);
        }
        if (PermissionConfig.PermissionType.CONFIG == type || PermissionConfig.PermissionType.ALL == type || PermissionConfig.PermissionType.TRANSACTION == type) {
            handleSecurityPermission(child, type);
        } else {
            handleSecurityPermissionGroup(child, type);
        }
    }
}
Also used : OnJoinPermissionOperationName(com.hazelcast.config.OnJoinPermissionOperationName) PermissionType(com.hazelcast.config.PermissionConfig.PermissionType) Node(org.w3c.dom.Node) YamlNode(com.hazelcast.internal.yaml.YamlNode) InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException)

Example 2 with OnJoinPermissionOperationName

use of com.hazelcast.config.OnJoinPermissionOperationName in project hazelcast by hazelcast.

the class MemberDomConfigProcessor method handleSecurityPermissions.

protected void handleSecurityPermissions(Node node) {
    String onJoinOp = getAttribute(node, "on-join-operation");
    if (onJoinOp != null) {
        OnJoinPermissionOperationName onJoinPermissionOperation = OnJoinPermissionOperationName.valueOf(upperCaseInternal(onJoinOp));
        config.getSecurityConfig().setOnJoinPermissionOperation(onJoinPermissionOperation);
    }
    for (Node child : childElements(node)) {
        String nodeName = cleanNodeName(child);
        PermissionType type = PermissionConfig.PermissionType.getType(nodeName);
        if (type == null) {
            throw new InvalidConfigurationException("Security permission type is not valid " + nodeName);
        }
        handleSecurityPermission(child, type);
    }
}
Also used : OnJoinPermissionOperationName(com.hazelcast.config.OnJoinPermissionOperationName) PermissionType(com.hazelcast.config.PermissionConfig.PermissionType) Node(org.w3c.dom.Node) InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException)

Aggregations

InvalidConfigurationException (com.hazelcast.config.InvalidConfigurationException)2 OnJoinPermissionOperationName (com.hazelcast.config.OnJoinPermissionOperationName)2 PermissionType (com.hazelcast.config.PermissionConfig.PermissionType)2 Node (org.w3c.dom.Node)2 YamlNode (com.hazelcast.internal.yaml.YamlNode)1