diff --git a/core/doctype/profile/profile.py b/core/doctype/profile/profile.py
index 40cea1c3f5..d6a6f409b8 100644
--- a/core/doctype/profile/profile.py
+++ b/core/doctype/profile/profile.py
@@ -252,7 +252,17 @@ Thank you,
if not validate_email_add(email):
webnotes.msgprint("%s is not a valid email id" % email)
raise Exception
-
+
+ def add_roles(self, *roles):
+ for role in roles:
+ self.bean.doclist.append({
+ "doctype": "UserRole",
+ "parentfield": "user_roles",
+ "role": role
+ })
+
+ self.bean.save()
+
@webnotes.whitelist()
def get_all_roles(arg=None):
"""return all roles"""
diff --git a/public/html/web.py b/public/html/web.py
index 2a5a13bdd5..d99f1856e9 100755
--- a/public/html/web.py
+++ b/public/html/web.py
@@ -28,7 +28,7 @@ session_stopped = """
We will be back in a few moments.