mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-23 02:27:05 +00:00
Fixing Z-Push sync errors
This commit is contained in:
parent
a3c71fe14f
commit
789b5ce485
@ -288,8 +288,9 @@ def add_mail_user(email, pw, privs, env):
|
|||||||
validation = validate_privilege(p)
|
validation = validate_privilege(p)
|
||||||
if validation: return validation
|
if validation: return validation
|
||||||
|
|
||||||
# get the database
|
# get the system database and OwnCloud database
|
||||||
conn, c = open_database(env, with_connection=True)
|
conn, c = open_database(env, with_connection=True)
|
||||||
|
conn_oc, c_oc = open_database(env, with_connection=True, db_path="/owncloud/owncloud.db")
|
||||||
|
|
||||||
# hash the password
|
# hash the password
|
||||||
pw = hash_password(pw)
|
pw = hash_password(pw)
|
||||||
@ -304,6 +305,15 @@ def add_mail_user(email, pw, privs, env):
|
|||||||
# write databasebefore next step
|
# write databasebefore next step
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
|
#fix sync cardDav error on Exchange connections, adding the user into OwnCloud DB
|
||||||
|
try:
|
||||||
|
c_oc.execute("INSERT INTO oc_users_external (backend, uid) VALUES (?, ?)",
|
||||||
|
("{127.0.0.1:993/imap/ssl/novalidate-cert}", email))
|
||||||
|
except sqlite3.IntegrityError:
|
||||||
|
return ("User already exists on calendar/contact server.", 400)
|
||||||
|
|
||||||
|
conn_oc.commit()
|
||||||
|
|
||||||
# Update things in case any new domains are added.
|
# Update things in case any new domains are added.
|
||||||
return kick(env, "mail user added")
|
return kick(env, "mail user added")
|
||||||
|
|
||||||
@ -348,6 +358,13 @@ def remove_mail_user(email, env):
|
|||||||
return ("That's not a user (%s)." % email, 400)
|
return ("That's not a user (%s)." % email, 400)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
|
#delete user from OwnCloud DB too
|
||||||
|
conn_oc, c_oc = open_database(env, with_connection=True, db_path="/owncloud/owncloud.db")
|
||||||
|
c_oc.execute("DELETE FROM oc_users_external WHERE email=?", (email,))
|
||||||
|
if c.rowcount != 1:
|
||||||
|
return ("This email (%s) wasn't in contacts/calendar server.", % email, 400)
|
||||||
|
conn_oc.commit()
|
||||||
|
|
||||||
# Update things in case any domains are removed.
|
# Update things in case any domains are removed.
|
||||||
return kick(env, "mail user removed")
|
return kick(env, "mail user removed")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user