Skip to main content

permissions-setup

This section handles the control of user access for adding records.

Method

Customizing permission logic becomes essential to verify if the current user possesses the requisite permissions for adding new records. Customizes permission logic to verify whether the current user has the necessary permissions to add records.

Custom Permission Check

Implement the some_custom_permission_check method to assess the user's authorization, aligning with your application's specific requirements and user roles.

Additional Customizations

This section allows the inclusion of extra view methods and bespoke customizations following the permission validations, ensuring tailored functionality post-permissions.

 def display_add_button_check(self, request):

# Implement your custom permission logic here
# Example: Check if the user has the necessary permissions to add records

return some_custom_permission_check(request.user)

# Additional view methods and customizations can be added here

Example

 def display_add_button_check(self, request):   

from zcorue.core.utils import get_current_role

role = get_current_role()

if role:
return role.name in ["Patient","Doctor"]

return False