[GH-ISSUE #715] Internal error when I click on domain with domain admin user account #660

Closed
opened 2026-02-27 11:12:53 +03:00 by kerem · 6 comments
Owner

Originally created by @harobed on GitHub (Apr 27, 2015).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/715

Hi,

I've this bug :

GET http://modoboa.bearstech.dev/admin/domains/14/edit/ error 500

To fix it :

$ git diff
diff --git a/modoboa/lib/formutils.py b/modoboa/lib/formutils.py
index 4b1922b..3097209 100644
--- a/modoboa/lib/formutils.py
+++ b/modoboa/lib/formutils.py
@@ -211,6 +211,9 @@ class TabForms(object):
     template_name = "common/tabforms.html"

     def __init__(self, request, instances=None, classes=None):
+        if instances is not None:
+            self.instances = instances
+
         self.request = request
         to_remove = []
         for fd in self.forms:
@@ -221,7 +224,6 @@ class TabForms(object):
             if request.method == "POST":
                 args.append(request.POST)
             if instances is not None:
-                self.instances = instances
                 if hasattr(self, "check_%s" % fd["id"]):
                     if not getattr(self, "check_%s" % fd["id"])(instances[fd["id"]]):
                         to_remove += [fd]

Next after this fix, I've "Update" button in modal window in below screenshot. If I click on update, I've this error :

POST http://modoboa.bearstech.dev/admin/domains/108/edit 500

capture d ecran 2015-04-27 a 19 22 02

What is the good behaviour ? I should see the same dialog box that super admin ? like in screenshot below ?

capture d ecran 2015-04-27 a 19 26 28

Originally created by @harobed on GitHub (Apr 27, 2015). Original GitHub issue: https://github.com/modoboa/modoboa/issues/715 Hi, I've this bug : - I use modoboa v1.2.1 - I'm logged with domain admin user (not super admin user) - I'm on this page http://modoboa.bearstech.dev/admin/domains/#list/ - I click on domain in the list - In firebug, I've this error : ``` GET http://modoboa.bearstech.dev/admin/domains/14/edit/ error 500 ``` To fix it : ``` $ git diff diff --git a/modoboa/lib/formutils.py b/modoboa/lib/formutils.py index 4b1922b..3097209 100644 --- a/modoboa/lib/formutils.py +++ b/modoboa/lib/formutils.py @@ -211,6 +211,9 @@ class TabForms(object): template_name = "common/tabforms.html" def __init__(self, request, instances=None, classes=None): + if instances is not None: + self.instances = instances + self.request = request to_remove = [] for fd in self.forms: @@ -221,7 +224,6 @@ class TabForms(object): if request.method == "POST": args.append(request.POST) if instances is not None: - self.instances = instances if hasattr(self, "check_%s" % fd["id"]): if not getattr(self, "check_%s" % fd["id"])(instances[fd["id"]]): to_remove += [fd] ``` Next after this fix, I've "Update" button in modal window in below screenshot. If I click on update, I've this error : ``` POST http://modoboa.bearstech.dev/admin/domains/108/edit 500 ``` ![capture d ecran 2015-04-27 a 19 22 02](https://cloud.githubusercontent.com/assets/230143/7353322/e8eb4bc2-ed12-11e4-90ff-cf7d05670b3c.png) What is the good behaviour ? I should see the same dialog box that super admin ? like in screenshot below ? ![capture d ecran 2015-04-27 a 19 26 28](https://cloud.githubusercontent.com/assets/230143/7353396/73ef57b8-ed13-11e4-95be-ec61c34b5b5d.png)
kerem 2026-02-27 11:12:53 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@harobed commented on GitHub (Apr 28, 2015):

The problem is that my domain admin user (not super admin) haven't "admin.change_domain" permission.

It's here : https://github.com/tonioo/modoboa/blob/1.2.x/modoboa/extensions/admin/forms/domain.py#L274

I think that domain admin user must have "admin.change_domain" permission on its domain, isn't it ?

<!-- gh-comment-id:97060352 --> @harobed commented on GitHub (Apr 28, 2015): The problem is that my domain admin user (not super admin) haven't "admin.change_domain" permission. It's here : https://github.com/tonioo/modoboa/blob/1.2.x/modoboa/extensions/admin/forms/domain.py#L274 I think that domain admin user must have "admin.change_domain" permission on its domain, isn't it ?
Author
Owner

@tonioo commented on GitHub (Apr 28, 2015):

Hi,
a domain administrator is not supposed to change the properties of the domain he manages unless the amavis extension is enabled. Are you using it ? If you don't, you should not see the "Domains" menu entry at all.

Otherwise, it looks like you find an issue when a domain adminstrator tries to save a domain. I'm looking into it.

<!-- gh-comment-id:97124549 --> @tonioo commented on GitHub (Apr 28, 2015): Hi, a domain administrator is not supposed to change the properties of the domain he manages unless the amavis extension is enabled. Are you using it ? If you don't, you should not see the "Domains" menu entry at all. Otherwise, it looks like you find an issue when a domain adminstrator tries to save a domain. I'm looking into it.
Author
Owner

@tonioo commented on GitHub (Apr 28, 2015):

Sorry, my previous post was wrong about visibility. A domain administrator IS supposed to list and see the domain(s) he manages.

<!-- gh-comment-id:97126629 --> @tonioo commented on GitHub (Apr 28, 2015): Sorry, my previous post was wrong about visibility. A domain administrator IS supposed to list and see the domain(s) he manages.
Author
Owner

@tonioo commented on GitHub (Apr 28, 2015):

Here is a quick fix. Could you please test it ?

<!-- gh-comment-id:97140147 --> @tonioo commented on GitHub (Apr 28, 2015): Here is a quick fix. Could you please test it ?
Author
Owner

@harobed commented on GitHub (Apr 29, 2015):

Fixed, thanks

<!-- gh-comment-id:97354753 --> @harobed commented on GitHub (Apr 29, 2015): Fixed, thanks
Author
Owner

@w4ugit commented on GitHub (Apr 12, 2021):

I have the same problem. how can i solve it?

<!-- gh-comment-id:817742477 --> @w4ugit commented on GitHub (Apr 12, 2021): I have the same problem. how can i solve it?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#660
No description provided.