Appearance
@AdminOnly
The @AdminOnly annotation marks an entity as restricted to the Admin role when using the framework's default roles.
Usage
java
@AdminOnly
@SquizyEntity(displayFormat = "${name}")
@Entity
public class SystemConfig { /* ... */ }Effect
When the default roles are created on startup, entities annotated with @AdminOnly are treated differently:
- The Admin role receives authorities for all entities, including
@AdminOnlyones. - The Editor, Auditor, and User roles receive authorities only for entities not annotated with
@AdminOnly.
The framework's built-in entities (SquizyRole, SquizyAuthority, Oauth2SquizyUser, and AppToken) are already annotated with @AdminOnly.
WARNING
@AdminOnly only has effect when using the default roles created by DefaultSquizyRolesCreator. If you provide a custom SquizyRolesCreator, this annotation has no effect — your implementation controls which authorities each role receives. See Customizing Default Roles.
Target
| Target | Description |
|---|---|
| Class | Applied to @Entity classes annotated with @SquizyEntity |
Attributes
This annotation has no attributes.
See Also
- Default Roles → The
@AdminOnlyAnnotation — full context on how@AdminOnlyinteracts with default roles - Security Annotations — overview of all security-related annotations