Package jeeves.server

Examples of jeeves.server.UserSession


        assertEquals(2, _userRepo.count());

        final Update update = new Update();

        ServiceContext context = createServiceContext();
        final UserSession userSession = new UserSession();
        userSession.loginAs(startUser);
        context.setUserSession(userSession);

        Element request = new Element("request")
                .addContent(new Element(Params.ID).setText(""+startUser.getId()))
                .addContent(new Element(Params.PASSWORD).setText("password"))
View Full Code Here


        assertEquals(2, _userRepo.count());

        final Update update = new Update();

        ServiceContext context = createServiceContext();
        final UserSession userSession = new UserSession();
        userSession.loginAs(startUser);
        context.setUserSession(userSession);

        Element request = new Element("request")
                .addContent(new Element(Params.ID).setText(""+startUser.getId()))
                .addContent(new Element(Params.NAME).setText("firstname"))
View Full Code Here


        final Update update = new Update();

        ServiceContext context = createServiceContext();
        final UserSession userSession = new UserSession();
        userSession.loginAs(updatingUser);
        context.setUserSession(userSession);

        Element request = new Element("request")
                .addContent(new Element(Params.ID).setText(""+toUpdateUser.getId()))
                .addContent(new Element(Params.PROFILE).setText(Profile.Administrator.name()))
View Full Code Here

        assertEquals(2, _userRepo.count());

        final Update update = new Update();

        ServiceContext context = createServiceContext();
        final UserSession userSession = new UserSession();
        userSession.loginAs(startUser);
        context.setUserSession(userSession);

        Element request = new Element("request")
                .addContent(new Element(Params.NAME).setText("newname"))
                .addContent(new Element(Params.ID).setText(""+startUser.getId()))
View Full Code Here

        updatingUser = _userRepo.save(updatingUser);

        final Update update = new Update();

        ServiceContext context = createServiceContext();
        final UserSession userSession = new UserSession();
        userSession.loginAs(updatingUser);
        context.setUserSession(userSession);

        Element request = new Element("request")
                .addContent(new Element(Params.PASSWORD).setText("password"))
                .addContent(new Element(Params.ID).setText("" + toUpdateUser.getId()))
View Full Code Here

            ));

        final Update update = new Update();

        ServiceContext context = createServiceContext();
        final UserSession userSession = new UserSession();
        userSession.loginAs(updatingUser);
        context.setUserSession(userSession);

        Element request = new Element("request")
                .addContent(new Element(Params.PASSWORD).setText("password"))
                .addContent(new Element(Params.ID).setText("" + toUpdateUser.getId()))
View Full Code Here

            ));

        final Update update = new Update();

        ServiceContext context = createServiceContext();
        final UserSession userSession = new UserSession();
        userSession.loginAs(updatingUser);
        context.setUserSession(userSession);

        Element request = new Element("request")
                .addContent(new Element(Params.PASSWORD).setText("password"))
                .addContent(new Element(Params.ID).setText("" + toUpdateUser.getId()))
View Full Code Here

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

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    UserSession   us   = context.getUserSession();
    List<Element> list = OwnershipUtils.getOwnerUsers(context, us);

    Element result = new Element("root");

    for (Element user : list)
View Full Code Here

    public Element exec(Element params, ServiceContext context) throws Exception {
        int userId = Util.getParamAsInt(params, "id");

        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        UserSession us = context.getUserSession();
        AccessManager am = gc.getBean(AccessManager.class);

        Set<Integer> userGroups = am.getVisibleGroups(userId);
        Set<Integer> myGroups = am.getUserGroups(us, null, false);
View Full Code Here

  public void init(String appPath, ServiceConfig params) throws Exception {
  }

  public Element exec(Element params, ServiceContext context)
      throws Exception {
    UserSession session = context.getUserSession();

    if (!session.isAuthenticated())
      return new Element(Geonet.Elem.GROUPS);

    // --- retrieve user groups
    if (Profile.Administrator == session.getProfile()) {
            return context.getBean(GroupRepository.class).findAllAsXml(not(isReserved()));
    } else {
            final int userIdAsInt = session.getUserIdAsInt();
            final Specifications<UserGroup> spec = where(UserGroupSpecs.hasUserId(userIdAsInt)).and(UserGroupSpecs.isReservedGroup(false));
            return context.getBean(UserGroupRepository.class).findAllAsXml(spec);
    }
  }
View Full Code Here

TOP

Related Classes of jeeves.server.UserSession

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.