Beispiel #1
0
  @Transient
  @JsonIgnore
  public List<String> getAccessableBranch() throws Exception {

    if (NullEmptyChecker.isNullOrEmpty(accessableBranch)) {

      if (getDataAccessRestriction().equals(DataAccessRestriction.AllBranch.getVal())) {

        return null;
      } else if (getDataAccessRestriction().equals(DataAccessRestriction.Subordinate.getVal())) {

        Branch branch = branchRepo.find(getFidBranch());
        System.out.println("branch = " + branch);
        accessableBranch.addAll(branch.getAllSubordinateId());
        accessableBranch.add(getFidBranch());
      } else if (getDataAccessRestriction().equals(DataAccessRestriction.SelfBranch.getVal())) {

        accessableBranch = Arrays.asList(getFidBranch());
      } else {

        String[] accessItem = this.getAccessBranch().split(";");

        for (int x = 0; x < accessItem.length; x++) {
          accessableBranch.add(accessItem[x]);
        }
      }
    }

    return accessableBranch;
  }
Beispiel #2
0
  @Transient
  @JsonIgnore
  public Collection<? extends GrantedAuthority> getAuthorities() {

    if (authorities.isEmpty()) {

      for (Role role : roles) {

        String[] rights = role.getRights().split(";");

        for (String right : rights) {

          if (NullEmptyChecker.isNotNullOrEmpty(right)) {
            authorities.add(new SimpleGrantedAuthority("ROLE_" + right));
          }
        }
      }
    }
    return authorities;
  }