Table of Contents

Class RolePermissions

Namespace
Builvero.Application.Services
Assembly
Builvero.Application.dll

Centralized role capability helpers to keep authorization semantics consistent across the application. This class provides a single source of truth for role-based access control logic, ensuring that authorization decisions are made consistently throughout the codebase.

public static class RolePermissions
Inheritance
RolePermissions
Inherited Members

Methods

CanAccessAdminArea(UserRole)

Determines if a role can access the admin area (read access). Roles with admin area access can view administrative content but may have restricted write permissions.

public static bool CanAccessAdminArea(UserRole role)

Parameters

role UserRole

The user role to check

Returns

bool

True if the role is Admin, BetaTester, or Moderator; otherwise, false

Remarks

This method checks for read access to the admin area. Write permissions are checked separately using IsAdminWriteAllowed(UserRole).

CanUseUserArea(UserRole)

Determines if a role can use the normal user area (non-admin features). This includes standard user features like profile management, project participation, etc.

public static bool CanUseUserArea(UserRole role)

Parameters

role UserRole

The user role to check

Returns

bool

True if the role can use user area features; otherwise, false

Remarks

All standard roles (User, Moderator, Admin, BetaTester, TeamCandidate, TeamMember) can access user area features. This method is useful for filtering or displaying user-accessible content.

IsAdminLike(UserRole)

Determines if a role has admin-like privileges (read access to admin area). Admin-like roles can view admin content but may have restricted write permissions.

public static bool IsAdminLike(UserRole role)

Parameters

role UserRole

The user role to check

Returns

bool

True if the role is Admin or BetaTester; otherwise, false

Remarks

Admin-like roles have read access to the admin area but may be restricted from performing write operations. Use IsAdminWriteAllowed(UserRole) to check for write permissions.

IsAdminWriteAllowed(UserRole)

Determines if a role is allowed to perform admin write operations. Per specification, only the Admin role has write permissions in the admin area.

public static bool IsAdminWriteAllowed(UserRole role)

Parameters

role UserRole

The user role to check

Returns

bool

True if the role is Admin (has write permissions); otherwise, false

Remarks

This method is used to enforce write restrictions. BetaTester and Moderator roles can read admin content but cannot perform write operations.

IsReadOnlyAdmin(UserRole)

Determines if a role is a read-only admin (BetaTester). Read-only admins can view admin content but cannot perform write operations.

public static bool IsReadOnlyAdmin(UserRole role)

Parameters

role UserRole

The user role to check

Returns

bool

True if the role is BetaTester; otherwise, false

Remarks

BetaTester is a special role that provides read-only access to the admin area for testing and feedback purposes.