Package org.fao.geonet.domain

Examples of org.fao.geonet.domain.Profile


                  : settingMan.get("harvesting/id:"+id, -1);
    if (result == null) {
            return null;
        }

        Profile profile = context.getUserSession().getProfile();
    if (id != null) {
            // you're an Administrator
            if (profile == Profile.Administrator) {
          result = transform(result);
          addInfo(result);
View Full Code Here


    @Override
    public UserDetails mapUserFromContext(DirContextOperations userCtx,
            String username, Collection<? extends GrantedAuthority> authorities) {

        Profile defaultProfile;
        if (mapping.get("profile")[1] != null) {
            defaultProfile = Profile.valueOf(mapping.get("profile")[1]);
        } else {
            defaultProfile = Profile.RegisteredUser;
        }
View Full Code Here

            Map<String, ArrayList<String>> userInfo, LDAPUser userDetails);

    protected void addProfile(@Nonnull LDAPUser userDetails, @Nonnull String profileName, @Nullable Set<Profile> profileList) {
        // Check if profile exist in profile mapping table
        if (profileMapping != null) {
            Profile mapped = profileMapping.get(profileName);
            if (mapped != null) {
                profileName = mapped.name();
            }
        }

        if (Log.isDebugEnabled(Geonet.LDAP)) {
            Log.debug(Geonet.LDAP, "  Assigning profile " + profileName);
        }
        Profile profile = Profile.valueOf(profileName);
        if (profile != null) {
            userDetails.getUser().setProfile(profile);
            if (profileList != null) {
                profileList.add(profile);
            }
View Full Code Here

    List<Element> newList = new ArrayList<Element>();

    for (User elRec : users) {
            int userId = elRec.getId();
            Profile profile = elRec.getProfile();

      if (profileSet.contains(profile)) {
        if (hsMyGroups.containsAll(getUserGroups(context, userId))) {
          newList.add(elRec.asXml());
                }
View Full Code Here

        String firstname = Util.getHeader(headers, firstnameKey, "");
        String profileName = Util.getHeader(headers, profileKey, "");
        String group = Util.getHeader(headers, groupKey, "");

        // Make sure the profile name is an exact match
        Profile profile = context.getProfileManager().getCorrectCase(profileName);
        if (profile == null) {
            profile = Profile.Guest;
        }

        if (group.equals("")) {
View Full Code Here

            for (String privilegeDefinition : privileges) {
                Matcher m = pattern.matcher(privilegeDefinition);
                boolean b = m.matches();
                if (b) {
                    String group = m.group(groupIndexInPattern);
                    Profile profile = Profile.valueOf(m.group(profilIndexInPattern));

                    if (profile != null) {
                        if (!LDAPConstants.ALL_GROUP_INDICATOR.equals(group)) {
                            if (Log.isDebugEnabled(Geonet.LDAP)) {
                                Log.debug(Geonet.LDAP, "  Adding profile "
                                        + profile + " for group " + group);
                            }
                            userDetails.addPrivilege(group, profile);
                            profileList.add(profile);
                        } else {
                            profileList.add(profile);
                        }
                    }
                } else {
                    Log.error(Geonet.LDAP, "LDAP privilege info '"
                            + privilegeDefinition
                            + "' does not match search pattern '"
                            + privilegePattern + "'. Information ignored.");
                }
            }
            Profile highestUserProfile = ProfileManager.getHighestProfile(profileList.toArray(new Profile[0]));
            if (highestUserProfile != null) {
                if (Log.isDebugEnabled(Geonet.LDAP)) {
                    Log.debug(Geonet.LDAP, "  Highest user profile is "
                            + highestUserProfile);
                }
View Full Code Here

                    Matcher m = privilegeQueryPatternCompiled
                            .matcher(profileName);
                    boolean b = m.matches();
                    if (b) {
                        Profile p = Profile.findProfileIgnoreCase(m.group(1));
                        if (p == null) {
                            Log.debug(Geonet.LDAP, "profile is null " + getClass() + ".setProfilesAndPrivileges()");
                        }
                        if (profileMapping != null) {
                            Profile mapped = profileMapping.get(m.group(1));
                            if (mapped != null) {
                                p = mapped;
                            }
                        }
                        Log.debug(Geonet.LDAP, "ldap profileName is " + profileName + ", pattern matched " + m.group(1) + " adding profile " + p.name());

                        profileList.add(p);
                    } else {
                        Log.error(Geonet.LDAP, "LDAP profile '" + profileName
                                + "' does not match search pattern '"
                                + privilegeQueryPattern
                                + "'. Information ignored.");
                    }
                }
               
                // TODO: This is broken. 
                Profile highestUserProfile = ProfileManager.getHighestProfile(profileList.toArray(new Profile[profileList.size()]));
                if (highestUserProfile != null) {
                    if (Log.isDebugEnabled(Geonet.LDAP)) {
                        Log.debug(Geonet.LDAP, "  Highest user profile is "
                                + highestUserProfile);
                    }
View Full Code Here

        if (operationAllowed == null) {
            // Check user privileges
            // Session may not be defined when a harvester is running
            if (context.getUserSession() != null) {
                Profile userProfile = context.getUserSession().getProfile();
                if (!(userProfile == Profile.Administrator || userProfile == Profile.UserAdmin)) {
                    int userId = Integer.parseInt(context.getUserSession().getUserId());
                    // Reserved groups
                    if (ReservedGroup.isReserved(grpId)) {
View Full Code Here

    if (user == null) {
      return hs;
        }

    Profile profile = user.getProfile();

    List<Integer> groupIds;
    if (profile == Profile.Administrator) {
      groupIds = _groupRepository.findIds();
    } else {
View Full Code Here

        String id = params.getChildText(Params.ID);

        UserSession usrSess = context.getUserSession();
        if (!usrSess.isAuthenticated()) return new Element(Jeeves.Elem.RESPONSE);

        Profile myProfile = usrSess.getProfile();
        String myUserId = usrSess.getUserId();

        if (id == null) return new Element(Jeeves.Elem.RESPONSE);

        if (myProfile == Profile.Administrator || myProfile == Profile.UserAdmin || myUserId.equals(id)) {
View Full Code Here

TOP

Related Classes of org.fao.geonet.domain.Profile

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.