Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Privacy Rules and Data Access
📖 Scenario: You work in a company that handles customer information. You need to set up simple privacy rules to control who can see or change certain data.
🎯 Goal: Build a clear set of privacy rules that define who can access or modify specific types of data.
📋 What You'll Learn
Create a list of data types with exact names
Define a list of user roles with exact names
Assign access permissions for each role and data type
Specify modification rights for each role and data type
💡 Why This Matters
🌍 Real World
Companies use privacy rules to protect sensitive customer data and ensure only authorized people can see or change it.
💼 Career
Understanding privacy rules is important for roles in IT security, data management, and compliance to keep data safe and follow laws.
Progress0 / 4 steps
1
Create the list of data types
Create a list called data_types with these exact entries: 'Personal Info', 'Payment Details', 'Order History', 'Support Tickets'.
No-Code
Hint
Use square brackets to create a list and include all four data types as strings.
2
Define user roles
Create a list called user_roles with these exact entries: 'Admin', 'Support', 'Customer'.
No-Code
Hint
Use a list with the exact role names as strings.
3
Assign access permissions
Create a dictionary called access_permissions where keys are role names from user_roles and values are lists of data types from data_types that each role can access. Use these exact permissions: 'Admin' can access all data types, 'Support' can access 'Personal Info' and 'Support Tickets', 'Customer' can access 'Personal Info' and 'Order History'.
No-Code
Hint
Use a dictionary with role names as keys and lists of allowed data types as values.
4
Specify modification rights
Create a dictionary called modification_rights where keys are role names from user_roles and values are lists of data types from data_types that each role can modify. Use these exact rights: 'Admin' can modify all data types, 'Support' can modify only 'Support Tickets', 'Customer' cannot modify any data (empty list).
No-Code
Hint
Use a dictionary with role names as keys and lists of data types they can modify as values. Empty list means no modification rights.
Practice
(1/5)
1. What is the main purpose of privacy rules in data access?
easy
A. To protect personal and sensitive information from unauthorized access
B. To make all data publicly available
C. To delete data after one day
D. To allow anyone to change data freely
Solution
Step 1: Understand what privacy rules do
Privacy rules are designed to protect personal and sensitive data by controlling access.
Step 2: Identify the correct purpose
The correct purpose is to prevent unauthorized access and keep data safe.
Final Answer:
To protect personal and sensitive information from unauthorized access -> Option A
Quick Check:
Privacy rules protect data = A [OK]
Hint: Privacy rules always protect data access rights [OK]
Common Mistakes:
Thinking privacy rules make data public
Confusing privacy rules with data deletion policies
Assuming privacy rules allow free data changes
2. Which of the following is a correct way to restrict data access using privacy rules?
easy
A. Allow all users to view and edit data
B. Share data without any conditions
C. Disable all data access permanently
D. Grant access only to users with specific roles
Solution
Step 1: Review access control methods
Privacy rules often use roles or permissions to control who can access data.
Step 2: Identify the correct restriction method
Granting access only to users with specific roles limits data access properly.
Final Answer:
Grant access only to users with specific roles -> Option D
Quick Check:
Role-based access control = C [OK]
Hint: Use roles to limit who can see or change data [OK]
Common Mistakes:
Allowing all users to edit data
Sharing data without restrictions
Disabling access completely without reason
3. Consider a system where privacy rules allow only managers to view salary data. If a regular employee tries to access salary information, what will happen?
medium
A. The system denies access and shows an error or no data
B. The employee can view the salary data without restrictions
C. The employee can edit the salary data
D. The system automatically grants manager access to the employee
Solution
Step 1: Understand the privacy rule condition
Only managers are allowed to view salary data, so others should be blocked.
Step 2: Predict the system behavior for unauthorized access
The system will deny access and either show an error or hide the data from the employee.
Final Answer:
The system denies access and shows an error or no data -> Option A
Quick Check:
Unauthorized access blocked = B [OK]
Hint: Non-managers cannot see restricted salary data [OK]
Common Mistakes:
Assuming all employees can view salary
Thinking unauthorized users can edit data
Believing system changes user roles automatically
4. A privacy rule is set to allow only users with 'admin' role to edit data. However, a user without 'admin' role can still edit. What is the most likely cause?
medium
A. The data is public and does not require privacy rules
B. The user has the 'admin' role but it was not checked
C. The privacy rule is not properly applied or linked to the data
D. The system automatically grants edit rights to all users
Solution
Step 1: Analyze the privacy rule setup
If a user without 'admin' role can edit, the rule might not be applied correctly.
Step 2: Consider other options
User role mismatch or public data would not explain unauthorized editing if rule exists.
Final Answer:
The privacy rule is not properly applied or linked to the data -> Option C
Quick Check:
Misapplied privacy rule = A [OK]
Hint: Check if privacy rules are correctly connected to data [OK]
Common Mistakes:
Assuming user has admin role without verification
Ignoring rule application errors
Believing system grants all users edit rights
5. You want to create a privacy rule that allows users to view their own profile data but not others'. Which approach best achieves this?
hard
A. Allow all users to view all profiles without restrictions
B. Set a rule that users can only access data where user ID matches their own ID
C. Restrict all users from viewing any profile data
D. Allow only admins to view all profiles and users to view none
Solution
Step 1: Understand the requirement
Users should see only their own profile, not others'.
Step 2: Identify the correct privacy rule condition
Matching user ID with data owner ID ensures users access only their own data.
Final Answer:
Set a rule that users can only access data where user ID matches their own ID -> Option B
Quick Check:
User ID match controls access = D [OK]
Hint: Match user ID to data owner ID for personal access [OK]