예제 #1
0
  @Override
  public void dropRolesForUser(String sessID, String user, Set<UserRole> roles)
      throws RemoteException, SessionExpiredException, SQLException, SecurityException {
    checkAdmin(sessID);
    // Check if any of the roles given are already assigned, and if so remove them from the
    // roles to register.
    Set<UserRole> assignedRoles = getRolesForUser(sessID, user);
    if (assignedRoles.containsAll(roles)) {
      return;
    } else if (assignedRoles.size() > 0) {
      roles.removeAll(assignedRoles);
    }

    // register the remaining roles.
    TableSchema raTable = MedSavantDatabase.UserRoleAssignmentTableSchema;
    for (UserRole role : roles) {
      DeleteQuery dq = new DeleteQuery(raTable.getTableName());
      dq.addCondition(
          BinaryCondition.equalTo(
              raTable.getDBColumn(
                  MedSavantDatabase.UserRoleAssignmentTableSchema.COLUMNNAME_OF_USERNAME),
              user));
      dq.addCondition(
          BinaryCondition.equalTo(
              raTable.getDBColumn(
                  MedSavantDatabase.UserRoleAssignmentTableSchema.COLUMNNAME_OF_ROLE_ID),
              role.getRoleId()));
      ConnectionController.executeUpdate(sessID, dq.toString());
    }
  }
예제 #2
0
  public void removeAnnotationLogEntry(String sid, int updateId)
      throws SQLException, SessionExpiredException {

    TableSchema table = MedSavantDatabase.VariantpendingupdateTableSchema;
    DeleteQuery query = new DeleteQuery(table.getTable());
    query.addCondition(
        BinaryConditionMS.equalTo(
            table.getDBColumn(VariantPendingUpdateTableSchema.COLUMNNAME_OF_UPLOAD_ID), updateId));

    ConnectionController.executeUpdate(sid, query.toString());
  }