<!--
title: Use proper authorization attributes
domain: data-systems
topic: Security
language: TSX
source: PostHog/posthog
updated: 2025-07-30
url: https://awesomereviewers.com/reviewers/posthog-use-proper-authorization-attributes/
-->

Avoid using Django framework attributes like `is_staff` and `is_impersonated` for application role checking, as these serve different purposes (admin panel access and user impersonation respectively). Instead, use application-specific role validation methods to ensure proper authorization.

For role-based access control, import and use the appropriate organization logic:

```typescript
const { isAdminOrOwner } = useValues(organizationLogic)

// Use this instead of user?.is_staff
if (isAdminOrOwner) {
    // Admin/owner specific logic
}
```

This prevents potential authorization bypass vulnerabilities that could occur when framework attributes are misused for application-level access control decisions.
