src/dird/ua_cmds.c
static void do_enable_disable_cmd(UAContext *ua, bool setting)
{
   JOB *job = NULL;
   CLIENT *client = NULL;
   SCHED *sched = NULL;
   int i;

   if (find_arg(ua, NT_("batch")) > 0) {
      ua->send_msg(_("Job Attributes Insertion %sabled\n"), setting?"en":"dis");
      db_disable_batch_insert(setting);
      return;
   }

   /*
    * if (find_arg(ua, NT_("scheduler")) > 0) {
    *    ua->send_msg(_("Job Scheduler %sabled\n"), setting?"en":"dis");
    *    return;
    * }
    */

   i = find_arg(ua, NT_("job"));
   if (i >= 0) {
      if (ua->argv[i]) {
         LockRes();
         job = GetJobResWithName(ua->argv[i]);
         UnlockRes();
      } else {
         job = select_enable_disable_job_resource(ua, setting);
         if (!job) {
            return;
         }
      }
   }
   if (job) {
      if (!acl_access_ok(ua, Job_ACL, job->name())) {
         ua->error_msg(_("Unauthorized command from this console.\n"));
         return;
      }
      job->setEnabled(setting);
      ua->send_msg(_("Job \"%s\" %sabled\n"), job->name(), setting?"en":"dis");
   }

   i = find_arg(ua, NT_("client"));
   if (i >= 0) {
      if (ua->argv[i]) {
         LockRes();
         client = GetClientResWithName(ua->argv[i]);
         UnlockRes();
      } else {
         client = select_enable_disable_client_resource(ua, setting);
         if (!client) {
            return;
         }
      }
   }
   if (client) {
      if (!acl_access_client_ok(ua, client->name(), JT_BACKUP_RESTORE)) {
         ua->error_msg(_("Unauthorized command from this console.\n"));
         return;
      }
      client->setEnabled(setting);
      ua->send_msg(_("Client \"%s\" %sabled\n"), client->name(), setting?"en":"dis");
   }

   i = find_arg(ua, NT_("schedule"));
   if (i >= 0) {
      if (ua->argv[i]) {
         LockRes();
         sched = (SCHED *)GetResWithName(R_SCHEDULE, ua->argv[i]);
         UnlockRes();
      } else {
         sched = select_enable_disable_schedule_resource(ua, setting);
         if (!sched) {
            return;
         }
      }
   }
   if (sched) {
      if (!acl_access_ok(ua, Schedule_ACL, sched->name())) {
         ua->error_msg(_("Unauthorized command from this console.\n"));
         return;
      }
      sched->setEnabled(setting);
      ua->send_msg(_("Schedule \"%s\" %sabled\n"), sched->name(), setting?"en":"dis");
   }

   i = find_arg(ua, NT_("storage"));
   if (i >= 0) {
      do_storage_cmd(ua, setting?"enable":"disable");
   }

   if (i < 0 && !sched && !client && !job) {
      ua->error_msg(_("You must enter one of the following keywords: job, client, schedule, or storage.\n"));
   }

   return;
}
/*
 * Does all sorts of enable/disable commands: batch, scheduler (not implemented)
 *  job, client, schedule, storage
 */
Does all sorts of enable/disable commands: batch, scheduler (not implemented)
job, client, schedule, storage
Does all sorts of enable / disable commands : batch scheduler ( not implemented ) job client schedule storage
static void do_enable_disable_cmd(UAContext *ua, bool setting)
{
   JOB *job = NULL;
   CLIENT *client = NULL;
   SCHED *sched = NULL;
   int i;
   if (find_arg(ua, NT_("batch")) > 0) {
      ua->send_msg(_("Job Attributes Insertion %sabled\n"), setting?"en":"dis");
      db_disable_batch_insert(setting);
      return;
   }
   i = find_arg(ua, NT_("job"));
   if (i >= 0) {
      if (ua->argv[i]) {
         LockRes();
         job = GetJobResWithName(ua->argv[i]);
         UnlockRes();
      } else {
         job = select_enable_disable_job_resource(ua, setting);
         if (!job) {
            return;
         }
      }
   }
   if (job) {
      if (!acl_access_ok(ua, Job_ACL, job->name())) {
         ua->error_msg(_("Unauthorized command from this console.\n"));
         return;
      }
      job->setEnabled(setting);
      ua->send_msg(_("Job \"%s\" %sabled\n"), job->name(), setting?"en":"dis");
   }
   i = find_arg(ua, NT_("client"));
   if (i >= 0) {
      if (ua->argv[i]) {
         LockRes();
         client = GetClientResWithName(ua->argv[i]);
         UnlockRes();
      } else {
         client = select_enable_disable_client_resource(ua, setting);
         if (!client) {
            return;
         }
      }
   }
   if (client) {
      if (!acl_access_client_ok(ua, client->name(), JT_BACKUP_RESTORE)) {
         ua->error_msg(_("Unauthorized command from this console.\n"));
         return;
      }
      client->setEnabled(setting);
      ua->send_msg(_("Client \"%s\" %sabled\n"), client->name(), setting?"en":"dis");
   }
   i = find_arg(ua, NT_("schedule"));
   if (i >= 0) {
      if (ua->argv[i]) {
         LockRes();
         sched = (SCHED *)GetResWithName(R_SCHEDULE, ua->argv[i]);
         UnlockRes();
      } else {
         sched = select_enable_disable_schedule_resource(ua, setting);
         if (!sched) {
            return;
         }
      }
   }
   if (sched) {
      if (!acl_access_ok(ua, Schedule_ACL, sched->name())) {
         ua->error_msg(_("Unauthorized command from this console.\n"));
         return;
      }
      sched->setEnabled(setting);
      ua->send_msg(_("Schedule \"%s\" %sabled\n"), sched->name(), setting?"en":"dis");
   }
   i = find_arg(ua, NT_("storage"));
   if (i >= 0) {
      do_storage_cmd(ua, setting?"enable":"disable");
   }
   if (i < 0 && !sched && !client && !job) {
      ua->error_msg(_("You must enter one of the following keywords: job, client, schedule, or storage.\n"));
   }
   return;
}
static void do_enable_disable_cmd ( UAContext * ua , bool setting ) { JOB * job = NULL ; CLIENT * client = NULL ; SCHED * sched = NULL ; int i ; if ( find_arg ( ua , NT_ ( " " ) ) > 0 ) { ua -> send_msg ( _ ( " \n " ) , setting ? " " : " " ) ; db_disable_batch_insert ( setting ) ; return ; } i = find_arg ( ua , NT_ ( " " ) ) ; if ( i >= 0 ) { if ( ua -> argv [ i ] ) { LockRes ( ) ; job = GetJobResWithName ( ua -> argv [ i ] ) ; UnlockRes ( ) ; } else { job = select_enable_disable_job_resource ( ua , setting ) ; if ( ! job ) { return ; } } } if ( job ) { if ( ! acl_access_ok ( ua , Job_ACL , job -> name ( ) ) ) { ua -> error_msg ( _ ( " \n " ) ) ; return ; } job -> setEnabled ( setting ) ; ua -> send_msg ( _ ( " \" \" \n " ) , job -> name ( ) , setting ? " " : " " ) ; } i = find_arg ( ua , NT_ ( " " ) ) ; if ( i >= 0 ) { if ( ua -> argv [ i ] ) { LockRes ( ) ; client = GetClientResWithName ( ua -> argv [ i ] ) ; UnlockRes ( ) ; } else { client = select_enable_disable_client_resource ( ua , setting ) ; if ( ! client ) { return ; } } } if ( client ) { if ( ! acl_access_client_ok ( ua , client -> name ( ) , JT_BACKUP_RESTORE ) ) { ua -> error_msg ( _ ( " \n " ) ) ; return ; } client -> setEnabled ( setting ) ; ua -> send_msg ( _ ( " \" \" \n " ) , client -> name ( ) , setting ? " " : " " ) ; } i = find_arg ( ua , NT_ ( " " ) ) ; if ( i >= 0 ) { if ( ua -> argv [ i ] ) { LockRes ( ) ; sched = ( SCHED * ) GetResWithName ( R_SCHEDULE , ua -> argv [ i ] ) ; UnlockRes ( ) ; } else { sched = select_enable_disable_schedule_resource ( ua , setting ) ; if ( ! sched ) { return ; } } } if ( sched ) { if ( ! acl_access_ok ( ua , Schedule_ACL , sched -> name ( ) ) ) { ua -> error_msg ( _ ( " \n " ) ) ; return ; } sched -> setEnabled ( setting ) ; ua -> send_msg ( _ ( " \" \" \n " ) , sched -> name ( ) , setting ? " " : " " ) ; } i = find_arg ( ua , NT_ ( " " ) ) ; if ( i >= 0 ) { do_storage_cmd ( ua , setting ? " " : " " ) ; } if ( i < 0 && ! sched && ! client && ! job ) { ua -> error_msg ( _ ( " \n " ) ) ; } return ; }
Does all sorts of enable/disable commands: batch, scheduler (not implemented)
  job, client, schedule, storage
Does all sorts of enable / disable commands : batch scheduler ( not implemented ) job client schedule storage
/*
    * if (find_arg(ua, NT_("scheduler")) > 0) {
    *    ua->send_msg(_("Job Scheduler %sabled\n"), setting?"en":"dis");
    *    return;
    * }
    */