remoting: mail_relay_recipient

Discussion in 'Developers' Forum' started by ispcomm, Nov 13, 2013.

  1. ispcomm

    ispcomm Member

    Hi,

    I don't seem to find the way to add the recipients to a mail_relay_recipient table via the remoting api.

    I must be overlooking something, but a grep for mail_relay_recipient / mail_relay does not yield the result. I can see the web forms and description, but nothing in the remoting api.

    ispcomm.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    This function seems to be mising in the api currently. you can e.g. add them in the remoting.inc.php file.
     
  3. ispcomm

    ispcomm Member

    I'll try :)
     
  4. ispcomm

    ispcomm Member

    Here's my patch. I hope I understand your code properly. It's basically a copy-paste and search-replace with the functions from the mail_forwarding section.

    I did not find the proper permission for allowing relay manipulation, so I used the mail_transport permission for this.

    Code:
    # diff -u remoting.inc.org.php remoting.inc.php
    --- remoting.inc.org.php        2013-11-14 11:47:57.000000000 +0000
    +++ remoting.inc.php    2013-11-14 11:48:59.000000000 +0000
    @@ -630,6 +630,58 @@
                            $affected_rows = $this->deleteQuery('../mail/form/mail_forward.tform.php', $primary_id);
                            return $affected_rows;
            }
    +
    +
    +        //* Get mail relay_recipient details
    +        public function mail_relay_recipient_get($session_id, $primary_id)
    +    {
    +                global $app;
    +
    +                if(!$this->checkPerm($session_id, 'mail_transport_get')) {
    +                        $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
    +                        return false;
    +                }
    +                $app->uses('remoting_lib');
    +                $app->remoting_lib->loadFormDef('../mail/form/mail_relay_recipient.tform.php');
    +                return $app->remoting_lib->getDataRecord($primary_id);
    +        }
    +
    +        //* relay recipient email
    +        public function mail_relay_recipient_add($session_id, $client_id, $params)
    +        {
    +                        if (!$this->checkPerm($session_id, 'mail_transport_add'))
    +                        {
    +                                        $this->server->fault('permission_denied','You do not have the permissions to access this function.');
    +                                        return false;
    +                        }
    +                        $affected_rows = $this->insertQuery('../mail/form/mail_relay_recipient.tform.php', $client_id, $params);
    +                        return $affected_rows;
    +        }
    +
    +
    +        public function mail_relay_recipient_update($session_id, $client_id, $primary_id, $params)
    +        {
    +                        if (!$this->checkPerm($session_id, 'mail_transport_update'))
    +                        {
    +                                        $this->server->fault('permission_denied','You do not have the permissions to access this function.');
    +                                        return false;
    +                        }
    +                        $affected_rows = $this->updateQuery('../mail/form/mail_relay_recipient.tform.php', $client_id, $primary_id, $params);
    +                        return $affected_rows;
    +        }
    +
    +
    +        public function mail_relay_recipient_delete($session_id, $primary_id)
    +        {
    +                        if (!$this->checkPerm($session_id, 'mail_transport_delete'))
    +                        {
    +                                        $this->server->fault('permission_denied','You do not have the permissions to access this function.');
    +                                        return false;
    +                        }
    +                        $affected_rows = $this->deleteQuery('../mail/form/mail_relay_recipient.tform.php', $primary_id);
    +                        return $affected_rows;
    +        }
    +
    
            //* Get catchall details
            public function mail_catchall_get($session_id, $primary_id)
    
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

Share This Page