Package org.apache.jetspeed.security

Examples of org.apache.jetspeed.security.UserSubjectPrincipal


        RequestContext rc = getRequestContext();
        Map<String,String> map = null;
        Principal principal = rc.getRequest().getUserPrincipal();
        if (principal instanceof UserSubjectPrincipal)
        {
            UserSubjectPrincipal jp = (UserSubjectPrincipal)principal;
            map = jp.getUser().getInfoMap();
        }
        return map;
    }
View Full Code Here


            String adminRole = getServiceLocator().getPortalConfiguration().getString(PortalConfigurationConstants.ROLES_DEFAULT_ADMIN);           
            admin = getPortletRequest().isUserInRole(adminRole);
            if (!admin && !principal.getType().getName().equals(JetspeedPrincipalType.USER))
            {
                // no non-user type principal modification is allowed if the current user itself doesn't have this principal
                UserSubjectPrincipal currentUser = (UserSubjectPrincipal)getPortletRequest().getUserPrincipal();               
                if (!hasPrincipal(currentUser.getSubject(), principal))
                {
                    modificationAllowed = false;                   
                }                   
            }
            refreshList();
            ListView commentListView = new ListView("comments",
                    new PropertyModel(this, "associations"))
            {

                public void populateItem(final ListItem listItem)
                {
                    final JetspeedPrincipal principal = (JetspeedPrincipal) listItem
                            .getModelObject();
                    listItem.add(new Label("Name", principal.getName()));
                    boolean deleteAllowed = modificationAllowed;
                    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")));
                    if (!admin && deleteAllowed && !principal.getType().getName().equals(JetspeedPrincipalType.USER))
                    {
                        // restrict deleting non-user type principals to only those the current user itself has
                        UserSubjectPrincipal currentUser = (UserSubjectPrincipal)getPortletRequest().getUserPrincipal();               
                        if (!hasPrincipal(currentUser.getSubject(), principal))
                        {
                            deleteAllowed = false;
                        }                   
                    }
                    if (!deleteAllowed || !modificationAllowed)
View Full Code Here

                // restrict creating new associations to only those the user itself belongs to
                String jptName = associationsFrom ? associationType.getToPrincipalType().getName() : associationType.getFromPrincipalType().getName();
                if (!jptName.equals(JetspeedPrincipalType.USER))
                {
                    // get all current user principals of asssignable type as restricted list
                    UserSubjectPrincipal currentUser = (UserSubjectPrincipal)getPortletRequest().getUserPrincipal();               
                    List<JetspeedPrincipal> filter = SubjectHelper.getPrincipals(currentUser.getSubject(), jptName);
                    if (filter.isEmpty())
                    {
                        names.clear();
                    }
                    else
View Full Code Here

        RequestContext rc = getRequestContext();
        Map<String,String> map = null;
        Principal principal = rc.getRequest().getUserPrincipal();
        if (principal instanceof UserSubjectPrincipal)
        {
            UserSubjectPrincipal jp = (UserSubjectPrincipal)principal;
            map = jp.getUser().getInfoMap();
        }
        return map;
    }
View Full Code Here

    {
        Map<String,String> map = null;
        Principal principal = rc.getRequest().getUserPrincipal();
        if (principal instanceof UserSubjectPrincipal)
        {
            UserSubjectPrincipal jp = (UserSubjectPrincipal)principal;
            map = jp.getUser().getInfoMap();
        }
        return map;
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.UserSubjectPrincipal

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.