Ejemplo n.º 1
0
  @Override
  public boolean isLastSuperRole(UserAuthorityGroup userAuthorityGroup) {
    Collection<UserAuthorityGroup> groups = userAuthorityGroupStore.getAll();

    for (UserAuthorityGroup group : groups) {
      if (group.isSuper() && group.getId() != userAuthorityGroup.getId()) {
        return false;
      }
    }

    return true;
  }
Ejemplo n.º 2
0
  @Override
  public void assignDataSetToUserRole(DataSet dataSet) {
    User currentUser = currentUserService.getCurrentUser();

    if (!currentUserService.currentUserIsSuper() && currentUser != null) {
      UserCredentials userCredentials = getUserCredentials(currentUser);

      for (UserAuthorityGroup userAuthorityGroup : userCredentials.getUserAuthorityGroups()) {
        userAuthorityGroup.getDataSets().add(dataSet);

        updateUserAuthorityGroup(userAuthorityGroup);
      }
    }
  }