Ejemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  @Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
  public List<Job> getUsersJobs(final String username) {

    List<Job> jobs = null;
    User user = userDao.getUser(username);

    boolean administrator = false;

    if (AcegiUtil.containsRole(user.getAuthorities(), Roles.ADMIN.name())) {
      administrator = true;
    }

    if (administrator) {
      jobs = jobDao.getAllJobs();
    } else {
      jobs = jobDao.getAllUserJobs(username);
    }

    return jobs;
  }
Ejemplo n.º 2
0
 /** {@inheritDoc} */
 @Override
 @Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
 public List<Job> getJobs() {
   return jobDao.getAllJobs();
 }