diff --git a/py/core/doctype/profile/profile.py b/py/core/doctype/profile/profile.py index da09fd59e7..c4778c6180 100644 --- a/py/core/doctype/profile/profile.py +++ b/py/core/doctype/profile/profile.py @@ -57,14 +57,15 @@ class DocType: def logout_if_disabled(self): """logout if disabled""" - if cint(self.doc.disabled): + if not cint(self.doc.enabled): import webnotes.login_manager webnotes.login_manager.logout(self.doc.name) def validate_max_users(self): """don't allow more than max users if set in conf""" import conf - if hasattr(conf, 'max_users'): + # check only when enabling a user + if hasattr(conf, 'max_users') and self.doc.enabled: active_users = webnotes.conn.sql("""select count(*) from tabProfile where ifnull(enabled, 0)=1 and docstatus<2 and name not in ('Administrator', 'Guest')""")[0][0]