Package org.fao.geonet.domain

Examples of org.fao.geonet.domain.Profile


        if (!us.isAuthenticated()) {
            return false;
        }

        //--- check if the user is an administrator
        final Profile profile = us.getProfile();
        if (profile == Profile.Administrator)
      return true;

        //--- check if the user is the metadata owner
        //
View Full Code Here


  public Element serviceSpecificExec(Element params, ServiceContext context) throws Exception
  {
    String id = Util.getParam(params, Params.ID);

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

    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    DataManager dataMan = gc.getBean(DataManager.class);
View Full Code Here

        if (!profileSet.contains(Profile.Administrator.name())) {

            for (User user : all) {
                int userId = user.getId();
                Profile profile = user.getProfile();

                // TODO is this already equivalent to ID?
                if (user.getUsername().equals(context.getAuthentication().getName())) {
                    // user is permitted to access his/her own user information
                    continue;
                }
                Set<Integer> userGroups = getGroups(userId, profile);
                // Is user belong to one of the current user admin group?
                boolean isInCurrentUserAdminGroups = false;
                for (Integer userGroup : userGroups) {
                    if (hsMyGroups.contains(userGroup)) {
                        isInCurrentUserAdminGroups = true;
                        break;
                    }
                }
                // if (!hsMyGroups.containsAll(userGroups))
                if (!isInCurrentUserAdminGroups) {
                    usersToRemove.add(user.getId());
                }

                if (!profileSet.contains(profile.name())) {
                    usersToRemove.add(user.getId());
                }
            }
        }
        UserList res = new UserList();
View Full Code Here

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

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

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

        final UserRepository userRepository = context.getBean(UserRepository.class);
        final GroupRepository groupRepository = context.getBean(GroupRepository.class);
        final UserGroupRepository userGroupRepository = context.getBean(UserGroupRepository.class);
View Full Code Here

     *
     * @param profiles The list of profiles to analyze
     * @return The highest profile in the list
     */
    public static Profile getLowestProfile(String[] profiles) {
        Profile lowestProfile = null;
        int numberOfProfilesExtended = Profile.Administrator.getAll().size();
       
        for (String profileName : profiles) {
            Profile p = Profile.valueOf(profileName);
            Set<Profile> currentProfileSet = p.getAll();
            if (currentProfileSet.size() < numberOfProfilesExtended) {
                lowestProfile = p;
                numberOfProfilesExtended = currentProfileSet.size();
            }
        }
View Full Code Here

     *
     * @param profiles The list of profiles to analyze
     * @return The highest profile in the list
     */
    public static Profile getHighestProfile(Profile[] profiles) {
        Profile highestProfile = null;
        int numberOfProfilesExtended = 0;
       
        for (Profile profile : profiles) {
            Set<Profile> all = profile.getAll();
            if (all.size() > numberOfProfilesExtended) {
View Full Code Here

  //---
  //--------------------------------------------------------------------------

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    Profile profile = context.getUserSession().getProfile();

    return (Element) context.getProfileManager().getProfilesElement(profile);
  }
View Full Code Here

        UserSession us = context.getUserSession();

        if (us.getUserId() == null)
            throw new NoApplicableCodeEx("User not authenticated.");

        Profile profile = us.getProfile();

        // Only editors and above are allowed to insert metadata
        if (profile != Profile.Editor && profile != Profile.Reviewer
            && profile != Profile.UserAdmin && profile != Profile.Administrator)
            throw new NoApplicableCodeEx("User not allowed to insert metadata.");
View Full Code Here

    UserSession session = context.getUserSession();

    String sUsername = session.getUsername();
    String sName     = session.getName();
    String sSurname  = session.getSurname();
    Profile sProfile  = session.getProfile();

    if (sUsername == null)
      sUsername = Profile.Guest.name();

    if (sName == null)
      sName = sUsername;

    if (sSurname == null)
      sSurname = "";

    if (sProfile == null)
      sProfile = Profile.Guest;

    Element userId   = new Element("userId".addContent(session.getUserId());
    Element username = new Element("username").addContent(sUsername);
    Element name     = new Element("name")    .addContent(sName);
    Element surname  = new Element("surname") .addContent(sSurname);
    Element profile  = new Element("profile") .addContent(sProfile.name());

    Element sEl = new Element(Jeeves.Elem.SESSION)
      .addContent(userId)
      .addContent(username)
      .addContent(name)
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.