Package org.picketlink.idm.api

Examples of org.picketlink.idm.api.Role


      {
         hasMembership = true;
      }


      Role role = null;

      try
      {
         role = getIdentitySession().getRoleManager().getRole(type, userName, gid);
      }
      catch (Exception e)
      {
         //TODO:
         log.info("Identity operation error: ", e);

      }

      if (role != null &&
          (!isAssociationMapped() ||
           !getAssociationMapping().equals(role.getRoleType()) ||
           !ignoreMappedMembershipType())
         )
      {
         hasMembership = true;
      }
View Full Code Here


                Iterator<?> iter = getSecurityContext().getObjects(
                        new ClassObjectFilter(Role.class)).iterator();

                boolean found = false;
                while (iter.hasNext()) {
                    Role r = (Role) iter.next();
                    if (r.equals(role)) {
                        found = true;
                        break;
                    }
                }

                if (!found) {
                    getSecurityContext().insert(role);
                }
            }

            for (Group group : identity.getGroups()) {
                Iterator<?> iter = getSecurityContext().getObjects(
                        new ClassObjectFilter(Group.class)).iterator();

                boolean found = false;
                while (iter.hasNext()) {
                    Group g = (Group) iter.next();
                    if (g.equals(group)) {
                        found = true;
                        break;
                    }
                }

                if (!found) {
                    getSecurityContext().insert(group);
                }
            }

            Iterator<?> iter = getSecurityContext().getObjects(
                    new ClassObjectFilter(Role.class)).iterator();
            while (iter.hasNext()) {
                Role r = (Role) iter.next();

                if (!identity.hasRole(r.getRoleType().getName(),
                        r.getGroup().getName(), r.getGroup().getGroupType())) {
                    FactHandle fh = getSecurityContext().getFactHandle(r);
                    getSecurityContext().retract(fh);
                }
            }
        }
View Full Code Here

        //
        int i = 0;

        for (; i < roles.size(); i++) {

            Role role = roles.get(i);

            org.exoplatform.services.organization.Group exoGroup = ((GroupDAOImpl) getOrganizationService().getGroupHandler())
                    .convertGroup(role.getGroup());

            MembershipImpl memb = new MembershipImpl();
            memb.setGroupId(exoGroup.getId());
            memb.setUserName(role.getUser().getId());

            // LDAP store may return raw membership type as role type
            if (role.getRoleType().getName().equals("JBOSS_IDENTITY_MEMBERSHIP")) {
                memb.setMembershipType(getOrganizationService().getConfiguration().getAssociationMembershipType());
            } else {
                memb.setMembershipType(role.getRoleType().getName());
            }

            lastExisting = memb;

            memberships[i] = memb;
View Full Code Here

   {
      String gid =
         getIdentitySession().getPersistenceManager().
            createGroupKey(getGroupNameFromId(groupId), getGroupTypeFromId(groupId));

      Role role = getIdentitySession().getRoleManager().getRole(type, userName, gid);

      if (role == null)
      {
         return null;
      }
View Full Code Here

        if (isAssociationMapped() && getAssociationMapping().equals(type) && associated) {
            hasMembership = true;
        }

        Role role = null;

        try {
            role = getIdentitySession().getRoleManager().getRole(type, userName, gid);
        } catch (Exception e) {
            // TODO:
            handleException("Identity operation error: ", e);

        }

        if (role != null
                && (!isAssociationMapped() || !getAssociationMapping().equals(role.getRoleType()) || !ignoreMappedMembershipType())) {
            hasMembership = true;
        }

        Membership result = null;
View Full Code Here

        //
        int i = 0;

        for (; i < length; i++) {

            Role role = roles.get(i);

            org.exoplatform.services.organization.Group exoGroup = ((GroupDAOImpl) getOrganizationService().getGroupHandler())
                    .convertGroup(role.getGroup());

            MembershipImpl memb = new MembershipImpl();
            memb.setGroupId(exoGroup.getId());
            memb.setUserName(role.getUser().getId());

            // LDAP store may return raw membership type as role type
            if (role.getRoleType().getName().equals("JBOSS_IDENTITY_MEMBERSHIP")) {
                memb.setMembershipType(getOrganizationService().getConfiguration().getAssociationMembershipType());
            } else {
                memb.setMembershipType(role.getRoleType().getName());
            }

            lastExisting = memb;

            memberships[i] = memb;
View Full Code Here

        if (isAssociationMapped() && getAssociationMapping().equals(type) && associated) {
            hasMembership = true;
        }

        Role role = null;

        try {
            role = getIdentitySession().getRoleManager().getRole(type, userName, gid);
        } catch (Exception e) {
            // TODO:
            handleException("Identity operation error: ", e);

        }

        if (role != null
                && (!isAssociationMapped() || !getAssociationMapping().equals(role.getRoleType()) || !ignoreMappedMembershipType(groupId))) {
            hasMembership = true;
        }

        Membership result = null;
View Full Code Here

        //
        int i = 0;

        for (; i < length; i++) {

            Role role = roles.get(i);

            org.exoplatform.services.organization.Group exoGroup = ((GroupDAOImpl) getOrganizationService().getGroupHandler())
                    .convertGroup(role.getGroup());

            MembershipImpl memb = new MembershipImpl();
            memb.setGroupId(exoGroup.getId());
            memb.setUserName(role.getUser().getId());

            // LDAP store may return raw membership type as role type
            if (role.getRoleType().getName().equals("JBOSS_IDENTITY_MEMBERSHIP")) {
                memb.setMembershipType(getOrganizationService().getConfiguration().getAssociationMembershipType());
            } else {
                memb.setMembershipType(role.getRoleType().getName());
            }

            lastExisting = memb;

            memberships[i] = memb;
View Full Code Here

        if (isAssociationMapped() && getAssociationMapping().equals(type) && associated) {
            hasMembership = true;
        }

        Role role = null;

        try {
            role = getIdentitySession().getRoleManager().getRole(type, userName, gid);
        } catch (Exception e) {
            // TODO:
            handleException("Identity operation error: ", e);

        }

        if (role != null
                && (!isAssociationMapped() || !getAssociationMapping().equals(role.getRoleType()) || !ignoreMappedMembershipType(groupId))) {
            hasMembership = true;
        }

        Membership result = null;
View Full Code Here

                  new ClassObjectFilter(Role.class)).iterator();

            boolean found = false;
            while (iter.hasNext())
            {
               Role r = (Role) iter.next();
               if (r.equals(role))
               {
                  found = true;
                  break;
               }
            }
           
            if (!found)
            {
               getSecurityContext().insert(role);
            }
         }
        
         for (Group group : identity.getGroups())
         {
            Iterator<?> iter = getSecurityContext().getObjects(
                  new ClassObjectFilter(Group.class)).iterator();

            boolean found = false;
            while (iter.hasNext())
            {
               Group g = (Group) iter.next();
               if (g.equals(group))
               {
                  found = true;
                  break;
               }
            }
           
            if (!found)
            {
               getSecurityContext().insert(group);
            }
         }
        
         Iterator<?> iter = getSecurityContext().getObjects(
               new ClassObjectFilter(Role.class)).iterator();
         while (iter.hasNext())
         {
            Role r = (Role) iter.next();
           
            if (!identity.hasRole(r.getRoleType().getName(),
                  r.getGroup().getName(), r.getGroup().getGroupType()))
            {
               FactHandle fh = getSecurityContext().getFactHandle(r);
               getSecurityContext().retract(fh);
            }
         }
View Full Code Here

TOP

Related Classes of org.picketlink.idm.api.Role

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.