Package org.sonar.core.user

Examples of org.sonar.core.user.UserDto


  @Override
  public void grantUserRole(Resource resource, String login, String role) {
    if (resource.getId() != null) {
      DbSession session = myBatis.openSession(false);
      try {
        UserDto user = session.getMapper(UserMapper.class).selectUserByLogin(login);
        if (user != null) {
          permissionFacade.deleteUserPermission(Long.valueOf(resource.getId()), user.getId(), role, session);
          permissionFacade.insertUserPermission(Long.valueOf(resource.getId()), user.getId(), role, session);
          session.commit();
        }
      } finally {
        MyBatis.closeQuietly(session);
      }
View Full Code Here


      + "Third Line\n"
      + "Fourth Line\n"
      + "Fifth Line\n");
    tester.get(SnapshotSourceDao.class).insert(snapshotSource);

    UserDto john = new UserDto().setLogin("john").setName("John").setEmail("john@email.com");
    db.userDao().insert(session, john);

    session.commit();

    MockUserSession.set().setLogin("john").addComponentPermission(UserRole.CODEVIEWER, project.getKey(), file.getKey());
View Full Code Here

    result.assertJson(this.getClass(), "empty_result.json", false);
  }

  @Test
  public void issue() throws Exception {
    db.userDao().insert(session, new UserDto().setLogin("simon").setName("Simon").setEmail("simon@email.com"));
    db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));

    IssueDto issue = IssueTesting.newDto(rule, file, project)
      .setDebt(10L)
      .setStatus("OPEN").setResolution("OPEN")
      .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
View Full Code Here

    result.assertJson(this.getClass(), "issue.json", false);
  }

  @Test
  public void issues_on_different_projects() throws Exception {
    db.userDao().insert(session, new UserDto().setLogin("simon").setName("Simon").setEmail("simon@email.com"));

    IssueDto issue = IssueTesting.newDto(rule, file, project)
      .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
      .setStatus("OPEN").setResolution("OPEN")
      .setSeverity("MAJOR")
View Full Code Here

    result.assertJson(this.getClass(), "issues_on_different_projects.json", false);
  }

  @Test
  public void issue_with_comment() throws Exception {
    db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));

    IssueDto issue = IssueTesting.newDto(rule, file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
    db.issueDao().insert(session, issue);

    tester.get(IssueChangeDao.class).insert(session,
View Full Code Here

    result.assertJson(this.getClass(), "issue_with_comment.json", false);
  }

  @Test
  public void issue_with_action_plan() throws Exception {
    db.userDao().insert(session, new UserDto().setLogin("simon").setName("Simon").setEmail("simon@email.com"));
    db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));

    tester.get(ActionPlanDao.class).save(new ActionPlanDto()
      .setKey("AP-ABCD")
      .setName("1.0")
      .setStatus("OPEN")
View Full Code Here

    result.assertJson(this.getClass(), "issue_with_attributes.json", false);
  }

  @Test
  public void issue_with_extra_fields() throws Exception {
    db.userDao().insert(session, new UserDto().setLogin("simon").setName("Simon").setEmail("simon@email.com"));
    db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));

    tester.get(ActionPlanDao.class).save(new ActionPlanDto()
      .setKey("AP-ABCD")
      .setName("1.0")
      .setStatus("OPEN")
View Full Code Here

  }

  abstract void doExecute(Long templateId, String permission);

  Long getUserId() {
    UserDto userDto = userDao.selectActiveUserByLogin(updatedReference);
    if (userDto == null) {
      throw new BadRequestException("Unknown user: " + updatedReference);
    }
    return userDto.getId();
  }
View Full Code Here

        RuleDto ruleDto = db.ruleDao().getNullableByKey(session, profileActivity.ruleKey());
        profileActivity.ruleName(ruleDto != null ? ruleDto.getName() : null);

        String login = profileActivity.login();
        if (login != null) {
          UserDto user = db.userDao().selectActiveUserByLogin(login, session);
          profileActivity.authorName(user != null ? user.getName() : null);
        }
        result.getHits().add(profileActivity);
      }
      return result;
    } finally {
View Full Code Here

      json.prop("layout", dashboard.getColumnLayout());
      json.prop("desc", dashboard.getDescription());
      json.prop("global", dashboard.getGlobal());
      json.prop("shared", dashboard.getShared());
      if (dashboard.getUserId() != null) {
        UserDto user = dbClient.userDao().getUser(dashboard.getUserId());
        if (user != null) {
          json.name("owner").beginObject();
          // TODO to be shared and extracted from here
          json.prop("login", user.getLogin());
          json.prop("name", user.getName());
          json.endObject();
        }
      }
      // load widgets and related properties
      json.name("widgets").beginArray();
View Full Code Here

TOP

Related Classes of org.sonar.core.user.UserDto

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.