Concept Flow - Why access control protects data
User tries to access data
Check user identity
Verify user permissions
Allow access
Access control checks who the user is and what they are allowed to do before letting them see or change data.
GRANT SELECT ON employees TO 'user1'; -- user1 tries to SELECT data SELECT * FROM employees WHERE id=1;
| Step | Action | User | Permission Check | Result | Output |
|---|---|---|---|---|---|
| 1 | Grant SELECT on employees | admin | N/A | Permission granted to user1 | N/A |
| 2 | User1 attempts SELECT * FROM employees WHERE id=1 | user1 | Has SELECT permission? | Yes | Returns employee data with id=1 |
| 3 | User2 attempts SELECT * FROM employees WHERE id=1 | user2 | Has SELECT permission? | No | Access denied error |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 |
|---|---|---|---|---|
| user1_permission | None | SELECT on employees | SELECT on employees | SELECT on employees |
| user2_permission | None | None | None | None |
| query_result_user1 | None | None | Employee data row | Employee data row |
| query_result_user2 | None | None | None | Access denied |
Access control checks user identity and permissions before allowing data access. Permissions like SELECT, UPDATE control what actions users can do. Without proper permission, users get access denied errors. This protects data from unauthorized viewing or changes. Grant permissions explicitly to users to allow safe access.