Package org.apache.jetspeed.om.security

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


    {
        GroupManagement service = getService();

        try
        {
            Group group = service.getGroup("apache");
            service.saveGroup(group);
        }
        catch(Exception e)
        {
            fail(StringUtils.stackTrace(e));
View Full Code Here


     * @throws Exception
     */
    public void testJoinGroup() throws Exception
    {
        GroupManagement service = getService();
        Group group = null;

        try
        {
            service.joinGroup("turbine", "apache");
        }
View Full Code Here

     * @throws Exception
     */
    public void testUnjoinGroup() throws Exception
    {
        GroupManagement service = getService();
        Group group = null;

        try
        {
            service.unjoinGroup("turbine", "apache");
        }
View Full Code Here

     * @throws Exception
     */
    public void testInGroup() throws Exception
    {
        GroupManagement service = getService();
        Group group = null;

        try
        {
            boolean in = service.inGroup("admin", "Jetspeed");
            assertTrue(true == in);
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

    {
        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(Profiler.PARAM_USER);
            String name = user.getUserName();
            if (null != name && name.length() > 0)
            {
                path.append(File.separator)
                    .append(name);
            }
        }
        else if (group != null)
        {
            path.append(Profiler.PARAM_GROUP);
            String name = group.getName();
            if (null != name && name.length() > 0)
            {
                path.append(File.separator)
                    .append(name);
            }
View Full Code Here

                                       Context context,
                                       RunData rundata )
    {
        try
        {
            Group group = null;

            /*
             * Grab the mode for the form.
             */
            String mode = rundata.getParameters().getString(SecurityConstants.PARAM_MODE);

            // if we are updating or deleting - put the name in the context
            //
            if (mode != null && (mode.equals(SecurityConstants.PARAM_MODE_UPDATE) ||
                                 mode.equals(SecurityConstants.PARAM_MODE_DELETE)))
            {
                // get the primary key and put the object in the context
                String groupname = rundata.getParameters().getString(SecurityConstants.PARAM_ENTITY_ID);
                group = JetspeedSecurity.getGroup(groupname);
                context.put(SecurityConstants.CONTEXT_GROUP, group);
            }

            //
            // if there was an error, display the message
            //
            String msgid = rundata.getParameters().getString(SecurityConstants.PARAM_MSGID);
            if (msgid != null)
            {
                int id = Integer.parseInt(msgid);
                if (id < SecurityConstants.MESSAGES.length)
                    context.put(SecurityConstants.PARAM_MSG, SecurityConstants.MESSAGES[id]);

                // get the bad entered data and put it back for convenient update
                Group tempGroup = (Group)rundata.getUser().getTemp(TEMP_GROUP);
                if (tempGroup != null)
                    context.put(SecurityConstants.CONTEXT_GROUP, tempGroup);
            }
            context.put(SecurityConstants.PARAM_MODE, mode);

View Full Code Here

     * @param context The velocity context for this request.
     */
    public void doInsert(RunData rundata, Context context)
        throws Exception
    {
        Group group = null;
        try
        {
            //
            // validate that its not an 'blank' groupname -- not allowed
            //
            String name = rundata.getParameters().getString("name");
            if (name == null || name.trim().length() == 0)
            {
                DynamicURI duri = new DynamicURI (rundata);
                duri.addPathInfo(SecurityConstants.PANE_NAME, SecurityConstants.PANEID_GROUP_UPDATE);
                duri.addPathInfo(SecurityConstants.PARAM_MSGID, SecurityConstants.MID_INVALID_ENTITY_NAME);
                rundata.setRedirectURI(duri.toString());
                rundata.getUser().setTemp(TEMP_GROUP, null);
                return;
            }

            //
            // generate a new group
            //
            group = JetspeedGroupFactory.getInstance();
            group.setName(name);

            //
            // add the group
            ///
            JetspeedSecurity.addGroup(group);
View Full Code Here

     * @param context The velocity context for this request.
     */
    public void doUpdate(RunData rundata, Context context)
        throws Exception
    {
        Group group = null;
        try
        {
            //
            // get the group object from the selected group entry in the browser
            //
            group = JetspeedSecurity.getGroup(
                     rundata.getParameters().getString(SecurityConstants.PARAM_ENTITY_ID));

            //
            // update the group in the database
            //
            JetspeedSecurity.saveGroup(group);

        }
        catch (Exception e)
        {
           //  Log the error msg
            logger.error("Exception", e);

            //
            // error on update - display error message
            //
            DynamicURI duri = new DynamicURI (rundata);
            duri.addPathInfo(SecurityConstants.PANE_NAME, SecurityConstants.PANEID_GROUP_UPDATE);
            duri.addPathInfo(SecurityConstants.PARAM_MSGID, SecurityConstants.MID_UPDATE_FAILED);
            if (group != null)
                duri.addPathInfo(SecurityConstants.PARAM_ENTITY_ID, group.getName());
            duri.addQueryData(SecurityConstants.PARAM_MODE, SecurityConstants.PARAM_MODE_UPDATE);
            rundata.setRedirectURI(duri.toString());

           // save values that user just entered so they don't have to re-enter
           if (group != null)
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.