Problems with api and table fields

Discussion in 'Developers' Forum' started by mmmexp, Sep 18, 2014.

  1. mmmexp

    mmmexp New Member

    $client->mail_user_add($session_id, $client_id, $mail_user_record);

    I know that you didn't have in mind the migration process from 'something else to ispconfig' while architecturing the database, but it would be extremely helpful this: what you demand in API could actually be mirrored in tables i.e. if you demand $client_id, $mail_user_records(which is an array of table fields), so please make $client_id a field in that table too.

    Just an example: i want to add mail_users for every domain in mail_domain, and again i am demanded to insert $client_id which is not found in mail_domain table. (and mail_user table doesn't have it too if i want to update MASS emails through API, i work only through api because it doesn't replicate to mail server if i work directly on databae which would be much easier...). So i need to get $client_id from web_domain table (the only place i can match domains?), but i don't have web_domains matching mail_domains.... and here starts the problems of getting right client_id for mail_domain.

    I hope the problem is clear. Thanks.
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    We had migrations in mind and we have a migration script to migrate complete installations from plesk, cpanel, confixx, ispconfig 2 and ispconfig 3 servers to ispconfig 3. This script uses only the official remote api, so all you need for a migration is available in the api and working fine.

    I guess you did not use the API function:

    client_get_id($session_id, $sys_userid)

    which can be used to get the client ID for a record based on its sys_userid.

    Beside that, you never use the web_domain table to get a ID for a mail user. You use the mail_domain table or when you just update an existing mail_user, then you even use the mail_user table as each record in each table holds the full user details and permissions for this record and can therefor be used to obtain the client ID.
    Last edited: Sep 18, 2014
  3. mmmexp

    mmmexp New Member

    I wouldn't use web_domain table to get an ID for mail_user if it wouldn't have client_id field, but web_domain has client_id field while mail_domain doesn't so it is the only place i can do web_domain.domain=my_system.domain and get right client_id for creation of mail_user for that domain.
    On other hand i didn't see client_get_id so it is an indiscretion on my part. It saves me a lot.

    thanks again, till.
    As always you help a lot!
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The web_domain table has no client_id field. Maybe you added one in your code but in the official ispconfig releases, there is no such field as it would be redundant and makes no sense to have that field. The permissions are calcuated internally based on the user and group, the client_id is only a simplification for the api and is translated to the correect user and group settings in the database by the api internally.
  5. mmmexp

    mmmexp New Member

    I am sorry i have confused cliend_id field with system_group = clientXX
    (i.e. iin past i got client_id from sbustringing system_group field)

    one last question:

    in spamfilter_policy table i see this field:

    policyd_greylist | enum('Y','N') | NO | | N

    in panel i don't see a place where to make it 'Y'.

    where it is used? ( or is it left for postgrey to use in some way?)
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    I dont recommend that as they can be different.

    Thats not used yet. policyd support is planned for 3.1

Share This Page