Examples of JetspeedPrincipal


Examples of org.apache.jetspeed.security.JetspeedPrincipal

        for (String s : SSO_TYPES)
            ssoTypesList.add(s);
    }
   
    protected JetspeedPrincipal getLocalPrincipal(String localUserName){
        JetspeedPrincipal localPrincipal = null;
       
        try{
            localPrincipal = userManager.getUser(localUserName);
        } catch (SecurityException secex){
           
View Full Code Here

Examples of org.apache.jetspeed.security.JetspeedPrincipal

        final DataView<JetspeedPrincipal> principalView = new DataView<JetspeedPrincipal>("entries", principalDataProvider)
        {
            @Override
            protected void populateItem(Item<JetspeedPrincipal> item)
            {
                final JetspeedPrincipal user = (JetspeedPrincipal) item.getModelObject();
                Link editLink = new Link("link", item.getModel())
                {
                    @Override
                    public void onClick()
                    {
                        JetspeedPrincipal user = (JetspeedPrincipal) getModelObject();
                        setPrincipal(user);
                        controlPannels(true);
                    }
                };
                editLink.add(new Label("name", user.getName()));
                item.add(editLink);
            }
        };
        principalView.setItemsPerPage(10);
        group.add(principalView);
View Full Code Here

Examples of org.apache.jetspeed.security.JetspeedPrincipal

                @Override
                public void onSubmit()
                {
                    UserManager userManager = (UserManager)getManager();
                    JetspeedPrincipal principal = getManager().newPrincipal(
                            getUserName(), false);
                    RoleManager roleManager = ((AbstractAdminWebApplication)getApplication()).getServiceLocator().getRoleManager();
                    PageManager pageManager = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPageManager();
                    try
                    {
View Full Code Here

Examples of org.apache.jetspeed.security.JetspeedPrincipal

            userName.add(new PrincipalNameValidator());
            userForm.add(userName);
            Button newUser = new Button("addUser",new ResourceModel(principalParam +".add.button")){
        @Override
        public void onSubmit() {
          JetspeedPrincipal principal =  getManager().newPrincipal(getUserName(),false);
          try{
            getManager().addPrincipal(principal, null);
            setPrincipal(principal);
            controlPannels(true);
            principalDataProvider.refresh(getManager(),getSearchString());
View Full Code Here

Examples of org.apache.jetspeed.security.JetspeedPrincipal

            profileForm.add(new Button("submit", new ResourceModel(
                    principalParam + ".update.button")){
                @Override
                public void onSubmit()
                {
                    JetspeedPrincipal principal = getManager().getPrincipal(
                            getName());
                    try
                    {
                        principal.setEnabled(isUserEnabled());
                        getManager().updatePrincipal(principal);
                        setPrincipal(principal);
                        principalDataProvider.refresh(getManager(),getSearchString());
                    } catch (SecurityException jSx)
                    {
                        error(jSx.getMessage());
                    }
                }
            });
            profileForm.add(new Button("remove", new ResourceModel(principalParam + ".remove.button")){
                @Override
                public void onSubmit()
                {
                    try
                    {
                        getManager().removePrincipal(principal.getName());
                        setPrincipal(null);
                        controlPannels(false);
                        principalDataProvider.refresh(getManager(),getSearchString());
                    }
                    catch (SecurityException e)
View Full Code Here

Examples of org.apache.jetspeed.security.JetspeedPrincipal

       
        super.doView(request, response);
    }
       
    protected JetspeedPrincipal getJetspeedPrincipal(String principalType, String principalName) throws SecurityException {
      JetspeedPrincipal foundPrincipal = null;
      if (principalType.equals(JetspeedPrincipalType.USER)){
        foundPrincipal = userManager.getUser(principalName)
      } else if (principalType.equals(JetspeedPrincipalType.GROUP)){
        foundPrincipal = groupManager.getGroup(principalName);
      }
View Full Code Here

Examples of org.apache.jetspeed.security.JetspeedPrincipal

                    SSOSite site = sso.getSiteByName(siteName);
                   
                    if ( site != null )
                    {
                       
                      JetspeedPrincipal principal = getJetspeedPrincipal(principalType,principalName);
                      if (principal != null){
                        Collection<SSOUser> ssoUsers = sso.getRemoteUsers(site, principal);
                        if (ssoUsers != null && ssoUsers.size() == 1){
                          sso.removeUser(ssoUsers.iterator().next());
                        } else {
                            // TODO: provide feedback, sso user not found
                          }   
                      } else {
                        // TODO: provide feedback, user not found
                     
                     
                        this.clearBrowserIterator(request);
                   }
                }
                catch (SSOException e)
                {
                    publishStatusMessage(request, "SSODetails", "status", e, "Could not remove credentials");
                }
                catch (SecurityException e)
                {
                    publishStatusMessage(request, "SSODetails", "status", e, "Could not remove credentials");
                }
            }
            else if (add != null)
            {
                // Roger: here is the principal type
                String principalType = request.getParameter("principal.type")//group user
                String portalPrincipal = request.getParameter("portal.principal");               
                String remotePrincipal = request.getParameter("remote.principal");
                String remoteCredential = request.getParameter("remote.credential");
               
                // The principal type can benull if the user just typed the name instead of
                // using the choosers.
               
                if (principalType == null || principalType.length() == 0 )
                    principalType = "user";
               
                if (!(StringUtils.isEmpty(remotePrincipal) || StringUtils.isEmpty(remotePrincipal) || StringUtils.isEmpty(remoteCredential)))
                {
                    try
                    {
                        String siteName = (String)PortletMessaging.receive(request, "site", "selectedName");                       
                        SSOSite site = sso.getSiteByName(siteName);

                        JetspeedPrincipal localPrincipal = getJetspeedPrincipal(principalType, portalPrincipal);
                       
                        if (site != null && localPrincipal != null )
                        {
                          if (sso.getRemoteUsers(site, localPrincipal).size() > 0)
                          {
                                try
                                {
                                    // TODO: fixme, bug in Pluto on portlet session
                                    PortletMessaging.publish(request, "SSODetails", "status", new StatusMessage("Could not add remote user: portal principal "+localPrincipal.getName()+" is already associated with a remote user for this site!", StatusMessage.ERROR));
                                }
                                catch (Exception e)
                                {
                                    logger.error("Failed to publish message: {}", e);
                                }
View Full Code Here

Examples of org.apache.jetspeed.security.JetspeedPrincipal

                    new PropertyModel(this, "associations"))
            {

                public void populateItem(final ListItem listItem)
                {
                    final JetspeedPrincipal principal = (JetspeedPrincipal) listItem
                            .getModelObject();
                    listItem.add(new Label("Name", principal.getName()));
                    Link deleteLink = new Link("delete")
                    {

                        @Override
                        public void onClick()
                        {
                            try
                            {
                                if (!associationsFrom)
                                {
                                    getManager().removeAssociation(principal,
                                            getPrincipal(), assoctionName);
                                } else
                                {
                                    getManager().removeAssociation(
                                            getPrincipal(), principal,
                                            assoctionName);
                                }
                                refreshList();
                            } catch (Exception e)
                            {
                                // TODO: handle exception
                            }
                        }
                    };
                    deleteLink.add(new Label("deleteLabel", new ResourceModel(
                            "common.delete")));
                    listItem.add(deleteLink);
                }
            };
            if(AssociationType.getFromPrincipalType().equals(principalType))
            {
                add(new Label("principalReleation",new ResourceModel(AssociationType.getToPrincipalType().getName())));   
            }else{
                add(new Label("principalReleation",new ResourceModel(AssociationType.getFromPrincipalType().getName())));
            }
            add(commentListView);
            add(new FeedbackPanel("feedback"));
            Form assocationsForm = new Form("assocationsForm");
            add(assocationsForm);
            DropDownChoice dropDown = new DropDownChoice(
                    "associationPrincipal", new PropertyModel(this,
                            "associationPrincipal"), getNames(),
                    new ChoiceRenderer("name", "name"));
            dropDown.setRequired(true);
            assocationsForm.add(dropDown);
            Button addRelations = new Button("addRelations", new ResourceModel(
                    "common.association.add"))
            {

                @Override
                public void onSubmit()
                {
                    try
                    {
                        JetspeedPrincipal toPrincipal = getPrincipal();
                        // JetspeedPrincipal fromPrincipal =
                        // getJetspeedPrincipalManagerProvider().getManager(type).getPrincipal(getAssociationPrincipal());
                        JetspeedPrincipal fromPrincipal = getAssociationPrincipal();
                        if (!associationsFrom)
                        {
                            getManager().addAssociation(fromPrincipal,
                                    toPrincipal, associationName);
                        } else
View Full Code Here

Examples of org.apache.jetspeed.security.JetspeedPrincipal

                }
                associationsFrom = true;
            }
            for (int count = 0; count < associations.size(); count++)
            {
                JetspeedPrincipal tmpPrincipal = (JetspeedPrincipal) associations
                        .get(count);
                JetspeedPrincipal listPrincipal;
                for (int index = 0; index < names.size(); index++)
                {
                    listPrincipal = (JetspeedPrincipal) names.get(index);
                    if (listPrincipal.getName().equals(tmpPrincipal.getName()))
                    {
                        names.remove(index);
                    }
                }
            }
            if (filter != null)
            {
              List copy = new ArrayList();
                for (int index = 0; index < names.size(); index++)
                {
                    JetspeedPrincipal listPrincipal = (JetspeedPrincipal) names.get(index);
                  for (int count = 0; count < filter.size(); count++)
                  {
                        JetspeedPrincipal tmpPrincipal = (JetspeedPrincipal) filter.get(count);
                    if (listPrincipal.getName().equals(tmpPrincipal.getName()))
                    {
                      copy.add(listPrincipal);
                      break;
                    }
                  }
View Full Code Here

Examples of org.apache.jetspeed.security.JetspeedPrincipal

    return user;
  }

  public void removeUser(String username) throws SecurityException
  {
    JetspeedPrincipal user;
   
    user = getUser(username);
    super.removePrincipal(user);
  }
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.