Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions quickdo/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,3 +699,18 @@ def register_user(full_name, email, password, redirect_to="/quickdo"):
"success": True,
"message": f"User has been registered successfully {full_name}",
}


# ! api/method/quickdo.api.has_app_permission
# ? CHECK IF THE USER HAS PERMISSION TO ACCESS QUICKDO APP
def has_app_permission():
"""Check if the user has permission to access the app."""
if frappe.session.user == "Administrator":
return True

roles = frappe.get_roles()
quickdo_roles = ["QuickDo User", "System Manager"]
if any(role in roles for role in quickdo_roles):
return True

return False
2 changes: 1 addition & 1 deletion quickdo/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"logo": "/assets/quickdo/favicon.png",
"title": "QuickDo",
"route": "/app/quickdos",
# "has_permission": "quickdo.api.permission.has_app_permission",
"has_permission": "quickdo.api.has_app_permission",
}
]

Expand Down