Package org.apache.turbine.om.security

Examples of org.apache.turbine.om.security.Group


     *            storage.
     */
    public Group getGroupById(int id)
            throws DataBackendException, UnknownEntityException
    {
        Group group = getAllGroups().getGroupById(id);
        if (group == null)
        {
            throw new UnknownEntityException(
                    "The specified group does not exist");
        }
View Full Code Here


            List results = new ArrayList();

            // Populate the object(s).
            for (int i = 0; i < rows.size(); i++)
            {
                Group obj = TurbineSecurity.getGroupInstance(null);
                Record row = (Record) rows.get(i);
                ((SecurityObject) obj).setPrimaryKey(
                        new NumberKey(row.getValue(1).asInt()));
                ((SecurityObject) obj).setName(row.getValue(2).asString());
                byte[] objectData = row.getValue(3).asBytes();
View Full Code Here

            // foreach group in the system
            for (Iterator groupsIterator = getAllGroups().iterator();
                 groupsIterator.hasNext();)
            {
                Group group = (Group) groupsIterator.next();
                // get roles of user in the group
                RoleSet groupRoles = RolePeerManager.retrieveSet(user, group);
                // put the Set into roles(group)
                roles.put(group, groupRoles);
                // collect all permissions in this group
View Full Code Here

                {
                    throw new DataBackendException(
                        "Internal error - query returned "
                        + results.size() + " rows");
                }
                Group newGroup = (Group) results.get(0);
                // add the group to system-wide cache
                getAllGroups().add(newGroup);
                // return the object with correct id
                return newGroup;
            }
View Full Code Here

        //
        // Wrap the returned Objects into the configured Peer Objects.
        //
        for (Iterator it = list.iterator(); it.hasNext(); )
        {
            Group dr = getNewGroup((Persistent) it.next());
            newList.add(dr);
        }

        return newList;
    }
View Full Code Here

     *
     */

    public static Group getNewGroup(Persistent p)
    {
        Group g = null;
        try
        {
            Class groupWrapperClass = TurbineSecurity.getGroupClass();

            Class [] clazz = new Class [] { Persistent.class };
View Full Code Here

    public void testGroupByName()
            throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();

        Group role = ss.getGroupByName("Turbine");
        assertNotNull(role);
        assertEquals("Turbine", role.getName());
    }
View Full Code Here

    public void testGroupById()
            throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();

        Group role = ss.getGroupById(2);
        assertNotNull(role);
        assertEquals("Turbine", role.getName());
    }
View Full Code Here

    public void testAddGroup()
      throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();

        Group newbie = ss.getGroupInstance();
        newbie.setName("newbie");

        ss.addGroup(newbie);

        assertEquals("Group was not added", 3, ss.getAllGroups().size());

        try
        {
            Group turbine = ss.getGroupByName("Turbine");

            ss.addGroup(turbine);
            fail("Existing Group could be added!");
        }
        catch (Exception e)
        {
            assertEquals("Wrong Exception thrown: " + e.getClass().getName(), EntityExistsException.class, e.getClass());
        }

        try
        {
            Group empty = ss.getGroupInstance();

            ss.addGroup(empty);
            fail("Group with empty Groupname could be added!");
        }
        catch (Exception e)
View Full Code Here

    {
        SecurityService ss = TurbineSecurity.getService();

        assertEquals("Group was not added", 3, ss.getAllGroups().size());

        Group newbie = ss.getGroupByName("newbie");
        assertNotNull(newbie);

        ss.removeGroup(newbie);

        try
        {
            Group foo = ss.getGroupInstance();
            foo.setName("foo");

            ss.removeGroup(foo);
            fail("Non Existing Group could be deleted!");
        }
        catch (Exception e)
View Full Code Here

TOP

Related Classes of org.apache.turbine.om.security.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.