Package org.voltdb.catalog

Examples of org.voltdb.catalog.Group


            }
            final UserRef userRef = procedure.getAuthusers().add(userName);
            userRef.setUser(user);
        }
        for (String groupName : procedureDescriptor.m_authGroups) {
            final Group group = db.getGroups().get(groupName);
            if (group == null) {
                throw compiler.new VoltCompilerException("Procedure " + className + " has a group " + groupName + " that does not exist");
            }
            final GroupRef groupRef = procedure.getAuthgroups().add(groupName);
            groupRef.setGroup(group);
View Full Code Here


            }
            final UserRef userRef = procedure.getAuthusers().add(userName);
            userRef.setUser(user);
        }
        for (String groupName : procedureDescriptor.m_authGroups) {
            final Group group = db.getGroups().get(groupName);
            if (group == null) {
                throw compiler.new VoltCompilerException("Procedure " + className + " has a group " + groupName + " that does not exist");
            }
            final GroupRef groupRef = procedure.getAuthgroups().add(groupName);
            groupRef.setGroup(group);
View Full Code Here

                // process the @groups comma separated list
                if (user.getGroups() != null) {
                    String grouplist[] = user.getGroups().split(",");
                    for (final String group : grouplist) {
                        final GroupRef groupRef = catUser.getGroups().add(group);
                        final Group catalogGroup = db.getGroups().get(group);
                        if (catalogGroup != null) {
                            groupRef.setGroup(catalogGroup);
                        }
                    }
                }
View Full Code Here

            }
            final UserRef userRef = catconn.getAuthusers().add(userName);
            userRef.setUser(user);
        }
        for (String groupName : groupslist) {
            final Group group = catdb.getGroups().get(groupName);
            if (group == null) {
                throw new VoltCompilerException("Export connector " + conn.getClazz() + " has a group " + groupName + " that does not exist");
            }
            final GroupRef groupRef = catconn.getAuthgroups().add(groupName);
            groupRef.setGroup(group);
View Full Code Here

            assertNotNull(groups);
            assertTrue(roles.length <= groups.size());

            for (TestRole role : roles) {
                Group group = groups.get(role.name);
                assertNotNull(String.format("Missing role \"%s\"", role.name), group);
                assertEquals(String.format("Role \"%s\" sql flag mismatch:", role.name), role.sql, group.getSql());
                assertEquals(String.format("Role \"%s\" sqlread flag mismatch:", role.name), role.sqlread, group.getSqlread());
                assertEquals(String.format("Role \"%s\" admin flag mismatch:", role.name), role.sysproc, group.getAdmin());
                assertEquals(String.format("Role \"%s\" defaultproc flag mismatch:", role.name), role.defaultproc, group.getDefaultproc());
                assertEquals(String.format("Role \"%s\" defaultprocread flag mismatch:", role.name), role.defaultprocread, group.getDefaultprocread());
                assertEquals(String.format("Role \"%s\" allproc flag mismatch:", role.name), role.allproc, group.getAllproc());
            }
        }
        else {
            assertFalse(String.format("Expected error (\"%s\")\nXML: %s\nDDL: %s", errorRegex, rolesElem, ddl), success);
            assertFalse("Expected at least one error message.", error.isEmpty());
View Full Code Here

    }

    @Test
    public void testPermissionsFromGroup()
    {
        Group group = new Group();
        final EnumSet<Permission> none = Permission.getPermissionSetForGroup(group);

        group = new Group();
        group.setSql(true);
        final EnumSet<Permission> sql = Permission.getPermissionSetForGroup(group);

        group = new Group();
        group.setSqlread(true);
        final EnumSet<Permission> sqlread = Permission.getPermissionSetForGroup(group);

        group = new Group();
        group.setDefaultproc(true);
        final EnumSet<Permission> defaultproc = Permission.getPermissionSetForGroup(group);

        group = new Group();
        group.setAdmin(true);
        final EnumSet<Permission> admin = Permission.getPermissionSetForGroup(group);

        group = new Group();
        group.setSql(true);
        group.setDefaultprocread(true);
        group.setDefaultproc(true);
        final EnumSet<Permission> allthree = Permission.getPermissionSetForGroup(group);

        group = new Group();
        group.setSql(true);
        group.setDefaultproc(true);
        group.setAdmin(true);
        final EnumSet<Permission> mixed = Permission.getPermissionSetForGroup(group);

        verify(none, sql, sqlread, defaultproc, admin, admin, allthree, mixed);
    }
View Full Code Here

    }

    @Test
    public void testSetGroup()
    {
        Group group = new Group();
        Permission.setPermissionsInGroup(group, EnumSet.noneOf(Permission.class));
        assertFalse(group.getSql());
        assertFalse(group.getAdmin());
        assertFalse(group.getDefaultproc());
        assertFalse(group.getDefaultprocread());

        group = new Group();
        Permission.setPermissionsInGroup(group, EnumSet.of(Permission.SQL));
        assertTrue(group.getSql());
        assertFalse(group.getAdmin());
        assertFalse(group.getDefaultproc());
        assertFalse(group.getDefaultprocread());

        group = new Group();
        Permission.setPermissionsInGroup(group, EnumSet.of(Permission.ADMIN));
        assertFalse(group.getSql());
        assertTrue(group.getAdmin());
        assertFalse(group.getDefaultproc());
        assertFalse(group.getDefaultprocread());

        group = new Group();
        Permission.setPermissionsInGroup(group, EnumSet.of(Permission.SQL, Permission.DEFAULTPROC, Permission.DEFAULTPROCREAD));
        assertTrue(group.getSql());
        assertFalse(group.getAdmin());
        assertTrue(group.getDefaultproc());
        assertTrue(group.getDefaultprocread());

        group = new Group();
        Permission.setPermissionsInGroup(group, EnumSet.of(Permission.SQL, Permission.ADMIN));
        assertTrue(group.getSql());
        assertTrue(group.getAdmin());
        assertFalse(group.getDefaultproc());
        assertFalse(group.getDefaultprocread());
    }
View Full Code Here

        String shortName = deriveShortProcedureName(className);

        // add an entry to the catalog
        final Procedure procedure = db.getProcedures().add(shortName);
        for (String groupName : procedureDescriptor.m_authGroups) {
            final Group group = db.getGroups().get(groupName);
            if (group == null) {
                throw compiler.new VoltCompilerException("Procedure " + className + " has a group " + groupName + " that does not exist");
            }
            final GroupRef groupRef = procedure.getAuthgroups().add(groupName);
            groupRef.setGroup(group);
View Full Code Here

        }

        // add an entry to the catalog (using the full className)
        final Procedure procedure = db.getProcedures().add(shortName);
        for (String groupName : procedureDescriptor.m_authGroups) {
            final Group group = db.getGroups().get(groupName);
            if (group == null) {
                throw compiler.new VoltCompilerException("Procedure " + className + " has a group " + groupName + " that does not exist");
            }
            final GroupRef groupRef = procedure.getAuthgroups().add(groupName);
            groupRef.setGroup(group);
View Full Code Here

            catUser.setShadowpassword(hashedPW);

            // process the @groups and @roles comma separated list
            for (final String role : mergeUserRoles(user)) {
                final GroupRef groupRef = catUser.getGroups().add(role);
                final Group catalogGroup = db.getGroups().get(role);
                if (catalogGroup != null) {
                    groupRef.setGroup(catalogGroup);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Group

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.