Package org.apache.jetspeed.om.security

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


        throws JetspeedSecurityException
    {
        try
        {
            JetspeedUser user = JetspeedSecurity.getUser(username);
            Group group = this.getGroup(groupname);
            Role role = JetspeedSecurity.getRole(defaultRole);

            Criteria criteria = new Criteria();
            criteria.add(TurbineUserGroupRolePeer.USER_ID, user.getUserId());
            criteria.add(TurbineUserGroupRolePeer.GROUP_ID, group.getId());
            criteria.add(TurbineUserGroupRolePeer.ROLE_ID, role.getId());
            TurbineUserGroupRolePeer.doDelete(criteria);
        }
        catch(Exception e)
        {
View Full Code Here


        List groups;

        try
        {
            JetspeedUser user = JetspeedSecurity.getUser(username);
            Group group = this.getGroup(groupname);

            Criteria criteria = new Criteria();
            criteria.add(TurbineUserGroupRolePeer.USER_ID, user.getUserId());
            criteria.add(TurbineUserGroupRolePeer.GROUP_ID, group.getId());
            groups = TurbineUserGroupRolePeer.doSelect(criteria);

        }
        catch(Exception e)
        {
View Full Code Here

                Profile profile = (Profile)entry.getDocument();
                if (null == profile)
                {
                    continue;
                }
                Group pGroup = profile.getGroup();
                if (null != pGroup && pGroup.getName().equals(group.getName()))
                {
                    documents.remove(profile.getDocument().getName());
                }
            }
        }
View Full Code Here

    {
        StringBuffer path = new StringBuffer();

        // move the base dir is either user or role is specified
        Role role = locator.getRole();
        Group group = locator.getGroup();
        JetspeedUser user = locator.getUser();

        if (user != null)
        {
            path.append(PATH_USER);
            String name = user.getUserName();
            if (null != name && name.length() > 0)
            {
                path.append(File.separator)
                    .append(name);
            }
        }
        else if (group != null)
        {
            path.append(PATH_GROUP);
            String name = group.getName();
            if (null != name && name.length() > 0)
            {
                path.append(File.separator)
                    .append(name);
            }
View Full Code Here

    public Iterator query( QueryLocator locator )
    {
        List list = new LinkedList();

        Role role = locator.getRole();
        Group group = locator.getGroup();
        JetspeedUser user = locator.getUser();

        // search thru anonymous directories?
        int qm = locator.getQueryMode();
        if ((qm & QueryLocator.QUERY_USER) == QueryLocator.QUERY_USER)
        {
            Profile profile = createProfile();
            StringBuffer path = new StringBuffer();
            path.append(PATH_USER);
            String name = null;
            int state = STATE_INIT;
            if (null != user)
            {
                name = user.getUserName();
                profile.setUser( user );
                if (null != name)
                {
                    path.append(File.separator).append(name);
                    state = STATE_BASE;
                }
            }
            File base = this.rootDir;
            File file = new File(base, path.toString());
            String absPath = file.getAbsolutePath();
            QueryState qs = new QueryState( QUERY_BY_USER,
                                             profile,
                                             locator,
                                             list,
                                             name,
                                             state);
            subQuery(qs, absPath);
        }
        if ((qm & QueryLocator.QUERY_ROLE) == QueryLocator.QUERY_ROLE)
        {
            Profile profile = createProfile();
            StringBuffer path = new StringBuffer();
            path.append(PATH_ROLE);
            String name = null;
            int state = STATE_INIT;
            if (null != role)
            {
                name = role.getName();
                profile.setRole( role );
                if (null != name)
                {
                    path.append(File.separator).append(name);
                    state = STATE_BASE;
                }
            }
            File base = this.rootDir;
            File file = new File(base, path.toString());
            String absPath = null;

            try
            {
                absPath = file.getCanonicalPath();
            }
            catch (IOException e)
            {
                Log.error("PSMLManager: unable to resolve file path for "+ file);
            }

            QueryState qs = new QueryState( QUERY_BY_ROLE,
                                             profile,
                                             locator,
                                             list,
                                             name,
                                             state);
            subQuery(qs, absPath);
        }
        if ((qm & QueryLocator.QUERY_GROUP) == QueryLocator.QUERY_GROUP)
        {
            Profile profile = createProfile();
            StringBuffer path = new StringBuffer();
            path.append(PATH_GROUP);
            String name = null;
            int state = STATE_INIT;
            if (null != group)
            {
                name = group.getName();
                profile.setGroup( group );
                if (null != name)
                {
                    path.append(File.separator).append(name);
                    state = STATE_BASE;
View Full Code Here

                            qs.clearName = true;
                        }
                    }
                    else if (QUERY_BY_GROUP == qs.queryBy)
                    {
                        Group group = qs.profile.getGroup();
                        if (null == group)
                        {
                            group = JetspeedGroupFactory.getInstance();
                            group.setName(file.getName());
                            qs.profile.setGroup(group);
                            qs.clearName = true;
                        }
                    }
                }
View Full Code Here

    }

    protected void dumpProfile(Profile profile)
    {
        JetspeedUser user = profile.getUser();
        Group group = profile.getGroup();
        Role role = profile.getRole();
        if (profile.getAnonymous() == true)
            System.out.println("ANON USER");
        System.out.println("RESOURCE = " + profile.getName());
        if (null != user)
            System.out.println("USER = " + user.getUserName() );
        if (null != group)
            System.out.println("GROUP = " + group.getName() );
        if (null != role)
            System.out.println("ROLE = " + role.getName() );
        System.out.println("MEDIA TYPE = " + profile.getMediaType());
        System.out.println("LANGUAGE = " + profile.getLanguage());
        System.out.println("COUNTRY = " + profile.getCountry());
View Full Code Here

        String language = locator.getLanguage();
        String country = locator.getCountry();
        String pageName = locator.getName();
        String groupName = null;

        Group group = locator.getGroup();
        if (group != null) {
            groupName = group.getName();
        }

        if (groupName != null && groupName.length() > 0)
        {
            criteria.add(GROUP_NAME, groupName);
View Full Code Here

                                       Context context,
                                       RunData rundata )
    {
        try
        {
            Group group = null;
            /*
             * Grab the mode for the user form.
             */
            String mode = rundata.getParameters().getString(SecurityConstants.PARAM_MODE);

View Full Code Here

        int ix = 0;
        boolean sel = false;
        selected.add(ix, new Boolean(sel));
        while(groups.hasNext())
        {
            Group group = (Group)groups.next();
            masterGroups.add(group);
            sel = JetspeedSecurity.inGroup(user.getUserName(), group.getName());
            ix = ix + 1;
            selected.add(ix, new Boolean(sel));
        }
        masterGroups.trimToSize();
        selected.trimToSize();
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.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.