# RolePermission

## Description

RolePermission is a join model that represents the assignment of a permission to a role. This many-to-many relationship enables roles to have multiple permissions and permissions to be assigned to multiple roles. When a user is assigned a role, they inherit all permissions assigned to that role.

The assignment operation is idempotent - assigning the same permission twice does not create duplicate records.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [assignPermissionToRole](../commands/AssignPermissionToRole.md)
- [revokePermissionFromRole](../commands/RevokePermissionFromRole.md)

### Query Definitions

### Models

- RolePermission

### Invariants

- Role-Permission combination must be unique (no duplicate assignments)
- Referenced role must exist
- Referenced permission must exist

### Relationships

- **Belongs To Role**: Each RolePermission record references exactly one role
- **Belongs To Permission**: Each RolePermission record references exactly one permission
