Package org.apache.jetspeed.services.security

Examples of org.apache.jetspeed.services.security.GroupException


            criteria.add(TurbineUserGroupRolePeer.ROLE_ID, role.getId());
            TurbineUserGroupRolePeer.doInsert(criteria);
        }
        catch(Exception e)
        {
            throw new GroupException("Join group '" + groupname + "' to user '" + username + "' failed: ", e);
        }
    }
View Full Code Here


            criteria.add(TurbineUserGroupRolePeer.ROLE_ID, role.getId());
            TurbineUserGroupRolePeer.doDelete(criteria);
        }
        catch(Exception e)
        {
            throw new GroupException("Unjoin group '" + groupname + "' to user '" + username + "' failed: ", e);
        }

    }
View Full Code Here

            groups = TurbineUserGroupRolePeer.doSelect(criteria);

        }
        catch(Exception e)
        {
            throw new GroupException("Failed to check group '" +
                groupname + "'", e);
        }
        return ( groups.size() > 0 );
    }
View Full Code Here

            criteria.add(TurbineGroupPeer.GROUP_NAME, groupname);
            groups = TurbineGroupPeer.doSelect(criteria);
        }
        catch(Exception e)
        {
            throw new GroupException("Failed to retrieve group '" +
                groupname + "'", e);
        }
        if ( groups.size() > 1 )
        {
            throw new GroupException(
                "Multiple Groups with same groupname '" + groupname + "'");
        }
        if ( groups.size() == 1 )
        {
            TurbineGroup group = (TurbineGroup)groups.get(0);
            return group;
        }
        throw new GroupException("Unknown group '" + groupname + "'");

    }
View Full Code Here

        {
            groups = TurbineGroupPeer.doSelect(criteria);
        }
        catch(Exception e)
        {
            throw new GroupException(
                "Failed to check account's presence", e);
        }
        if (groups.size() < 1)
        {
            return false;
View Full Code Here

                groupClassName = serviceConf.getString(CONFIG_GROUP_CLASSNAME);                                                            
                groupClass = Class.forName(groupClassName);
            }
            catch(Exception e)
            {
                throw new GroupException(
                    "GroupFactory: Failed to create a Class object for Group implementation: " + e.toString());
            }
        }

        try
        {
            group = (Group)groupClass.newInstance();
            if (group instanceof BaseJetspeedGroup)
            {
                ((BaseJetspeedGroup)group).setNew(isNew);
            }           
        }
        catch(Exception e)
        {
            throw new GroupException("Failed instantiate an Group implementation object: " + e.toString());
        }

        return group;
    }
View Full Code Here

        removeutil("createTimeStamp", false);
        removeutil("modifyTimeStamp", false);      

        if (create)
        {
            if (JetspeedLDAP.addEntry(super.ldapurl, super.myAttrs) == false) throw new GroupException("Failed to insert group in LDAP!");
        }
        else if (JetspeedLDAP.exists(super.ldapurl))
        {
            JetspeedLDAP.deleteAttrs(super.ldapurl, super.rmAttrs);
            if (JetspeedLDAP.updateEntry(super.ldapurl, super.myAttrs) == false) throw new GroupException("Failed to update group in LDAP!");
        }
    }
View Full Code Here

        {
            user = JetspeedSecurity.getUser(new UserNamePrincipal(username));
        }
        catch(JetspeedSecurityException e)
        {
            throw new GroupException("Failed to Retrieve User: ", e);
        }
        Criteria criteria = new Criteria();
        criteria.add(TurbineUserGroupRolePeer.USER_ID, user.getUserId());
        List rels;
        HashMap groups;

        try
        {
            rels = TurbineUserGroupRolePeer.doSelect(criteria);
            if (rels.size() > 0)
            {
                groups = new HashMap(rels.size());
            }
            else
                groups = new HashMap();

            for (int ix = 0; ix < rels.size(); ix++)
            {
                TurbineUserGroupRole rel = (TurbineUserGroupRole)rels.get(ix);
                Group group = rel.getTurbineGroup();
                groups.put(group.getName(), group);
            }
        }
        catch(Exception e)
        {
            throw new GroupException("Failed to retrieve groups ", e);
        }
        return groups.values().iterator();
    }
View Full Code Here

        {
            groups = TurbineGroupPeer.doSelect(criteria);
        }
        catch(Exception e)
        {
            throw new GroupException("Failed to retrieve groups ", e);
        }
        return groups.iterator();
    }
View Full Code Here

    public void addGroup(Group group)
        throws JetspeedSecurityException
    {
        if(groupExists(group.getName()))
        {
            throw new GroupException("The group '" +
                group.getName() + "' already exists");
        }

        try
        {
            TurbineGroup tgroup = new TurbineGroup();
            tgroup.setGroupName(group.getName());
            Criteria criteria = TurbineGroupPeer.buildCriteria(tgroup);
            NumberKey key = (NumberKey)TurbineGroupPeer.doInsert(criteria);
            group.setId(key.toString());
        }
        catch(Exception e)
        {
            throw new GroupException("Failed to create group '" +
                group.getName() + "'", e);
        }

        try
        {
            addDefaultGroupPSML(group);
        }
        catch (Exception e)
        {
            try
            {
                removeGroup(group.getName());
            }
            catch (Exception e2)
            {
            }
            throw new GroupException("failed to add default PSML for Group resource", e);
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.services.security.GroupException

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.