Exemplo n.º 1
0
 @Override
 public boolean canUserAccessCorp(long userId, int corpId) {
   Corporation c = getCorporation(corpId);
   if (c == null) return false;
   if (c.getUserId() == userId) return true;
   User user = accountMgr.getUser(userId);
   if (user != null && user.isAdmin()) return true;
   return organizationDao.isUserInCorp(userId, corpId);
 }
Exemplo n.º 2
0
  @Override
  public boolean addTeamMembers(long curUserId, int corpId, String accountList) {
    if (!canUserManageCorp(curUserId, corpId)) return false;

    String[] accs = accountList.split(",");
    Corporation c = getCorporation(corpId);
    for (String acc : accs) {
      User u = accountMgr.getUser(acc);
      if (u != null) {
        if (!organizationDao.isUserInCorp(u.getId(), corpId) && u.getId() != c.getUserId()) {
          organizationDao.addUserToCorp(corpId, u.getId(), 3);
        }
      }
    }

    return true;
  }