Examples of GroupPrincipal


Examples of com.ecyrd.jspwiki.auth.GroupPrincipal

   
    public void testTargetedCommand()
    {
        // Get view command
        Command a = GroupCommand.VIEW_GROUP;
        GroupPrincipal group = new GroupPrincipal( "Test" );
       
        // Combine with wiki group; make sure it's not equal to old command
        Command b = a.targetedCommand( group );
        assertNotSame( a, b );
        assertEquals( a.getRequestContext(), b.getRequestContext() );
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.GroupPrincipal

    public void testGetApprover() throws WikiException
    {
        // Test properties says workflow.saveWikiPage approver is GP Admin; workflow.foo is 'janne'
        assertEquals(new WikiPrincipal("janne", WikiPrincipal.LOGIN_NAME), wm.getApprover("workflow.foo"));
        assertEquals(new GroupPrincipal("Admin"), wm.getApprover("workflow.bar"));
       
        // 'saveWikiPage' workflow doesn't require approval, so we will need to catch an Exception
        try
        {
            assertEquals(new GroupPrincipal("Admin"), wm.getApprover("workflow.saveWikiPage"));
        }
        catch (WikiException e)
        {
            // Swallow
            return;
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.GroupPrincipal

        a = resolver.findCommand( request, WikiContext.EDIT );
        assertNotSame( GroupCommand.VIEW_GROUP, a );
        assertEquals( "GroupContent.jsp", a.getContentTemplate() );
        assertEquals( "Group.jsp", a.getJSP() );
        assertEquals( "%uGroup.jsp?group=%n", a.getURLPattern() );
        assertEquals( new GroupPrincipal( "Foo" ), a.getTarget() );
    }
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.GroupPrincipal

        m_queue = m_engine.getWorkflowManager().getDecisionQueue();
        adminSession = m_engine.adminSession();
        janneSession = m_engine.janneSession();
        w = new Workflow("workflow.key", new WikiPrincipal("Owner1"));
        w.setWorkflowManager(m_engine.getWorkflowManager());
        d1 = new SimpleDecision(w, "decision1.key", new GroupPrincipal("Admin"));
        d2 = new SimpleDecision(w, "decision2.key", new WikiPrincipal("Owner2"));
        d3 = new SimpleDecision(w, "decision3.key", janneSession.getUserPrincipal());
        m_queue.add(d1);
        m_queue.add(d2);
        m_queue.add(d3);
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.GroupPrincipal

        // Create finish task
        finishTask = new TaskTest.NormalTask(w);

        // Create an intermetidate decision step
        Principal actor = new GroupPrincipal("Admin");
        decision = new SimpleDecision(w, "decision.AdminDecision", actor);

        // Hook the steps together
        initTask.addSuccessor(Outcome.STEP_COMPLETE, decision);
        decision.addSuccessor(Outcome.DECISION_APPROVE, finishTask);
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.GroupPrincipal

        // Before starting, actor should be null
        assertNull(w.getCurrentActor());

        // After starting, actor should be GroupPrincipal Admin
        w.start();
        assertEquals(new GroupPrincipal("Admin"), w.getCurrentActor());

        // After decision, actor should be null again
        Decision d = (Decision) w.getCurrentStep();
        d.decide(Outcome.DECISION_APPROVE);
        assertNull(w.getCurrentActor());
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.GroupPrincipal

       
        // <groupmember> implies TestGroup if Subject has GroupPermission("TestGroup")
        p1 = new GroupPermission( "*:<groupmember>", "view" );
        p2 = new GroupPermission ("*:TestGroup", "view" );
        s = new Subject();
        s.getPrincipals().add( new GroupPrincipal( "TestGroup" ) );
        assertTrue( subjectImplies( s, p1, p2 ) );
       
        // <groupmember> doesn't imply it if Subject has no GroupPermission("TestGroup")
        s = new Subject();
        s.getPrincipals().add( new WikiPrincipal( "TestGroup" ) );
        assertFalse( subjectImplies( s, p1, p2 ) );
       
        // <groupmember> doesn't imply it if Subject's GP doesn't match
        s = new Subject();
        s.getPrincipals().add( new GroupPrincipal( "FooGroup" ) );
        assertFalse( subjectImplies( s, p1, p2 ) );
       
        // <groupmember> doesn't imply it if p2 isn't GroupPermission type
        p2 = new PagePermission ("*:TestGroup", "view" );
        s = new Subject();
        s.getPrincipals().add( new GroupPrincipal( "TestGroup" ) );
        assertFalse( subjectImplies( s, p1, p2 ) );
       
        // <groupmember> implies TestGroup if not called with Subject combiner
        p1 = new GroupPermission( "*:<groupmember>", "view" );
        p2 = new GroupPermission ("*:TestGroup", "view" );
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.GroupPrincipal

        {
            Command command = m_wikiContext.getCommand();
            gotPermission = false;
            if ( command instanceof GroupCommand && command.getTarget() != null )
            {
                GroupPrincipal group = (GroupPrincipal)command.getTarget();
                String groupName = group.getName();
                String action = "view";
                if( EDIT_GROUP.equals( permission ) )
                {
                    action = "edit";
                }
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.GroupPrincipal

     */
    protected Group( String name, String wiki )
    {
        m_name = name;
        m_wiki = wiki;
        m_principal = new GroupPrincipal( name );
    }
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.GroupPrincipal

        {
            String groupName = request.getParameter( "group" );
            groupName = TextUtil.replaceEntities( groupName );
            if ( groupName != null && groupName.length() > 0 )
            {
                GroupPrincipal group = new GroupPrincipal( groupName );
                return command.targetedCommand( group );
            }
        }

        // No page provided; return an "ordinary" command
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.