Skip to content

BaseController

reference
1 min readUpdated

Kind: Controller

Source: Pams/API/Pams.API/Controllers/BaseController.cs (line 515)

Part of: Pams

Where it refuses work

  • BaseController stops the work with UnauthorizedAccessException when !HasAnyRole(roles).
  • BaseController stops the work with UnauthorizedAccessException when !HasAllRoles(roles).
  • BaseController stops the work with UnauthorizedAccessException when !HasCompletedTwoFactor — “Two-factor authentication required”.
  • BaseController stops the work with UnauthorizedAccessException when !ValidateCompanyAccess(companyId) — “Access denied to company resources”.
  • BaseController stops the work with UnauthorizedAccessException when !ValidateBranchAccess(branchId) — “Access denied to branch resources”.
  • BaseController stops the work with an early return when CurrentCompanyBranch != null, in 7 places.

When something fails

  • BaseController handles failure in 3 places: it logs it and continues in all 3.

Relationships

  • IMPORTS → DeflateCompressionFilter
  • IMPORTS → Person
  • IMPORTS → Employee
  • IMPORTS → PersonUser
  • IMPORTS → CompanyBranch
  • IMPORTS → UserPermissionBindingModel
  • IMPORTS → GetUserPermissions
  • IMPORTS → UserPermissionViewModel
  • IMPORTS → DomainException
  • IMPORTS → AuthorizationResult

Used by

219 references from 219 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (219)

  • AccountManagerTargetController — Pams/API/Pams.API/Controllers/BookingTarget/AccountManagerTargetController.cs:11
  • EmployeeBonusController — Pams/API/Pams.API/Controllers/BookingTarget/EmployeeBonusController.cs:11
  • FinanceBudgetController — Pams/API/Pams.API/Controllers/BookingTarget/FinanceBudgetController.cs:11
  • ForecastedBookingController — Pams/API/Pams.API/Controllers/BookingTarget/ForecastedBookingController.cs:11
  • PrincipalTargetController — Pams/API/Pams.API/Controllers/BookingTarget/PrincipalTargetController.cs:11
  • ProductTypeTargetController — Pams/API/Pams.API/Controllers/BookingTarget/ProductTypeTargetController.cs:11
  • TeamTargetController — Pams/API/Pams.API/Controllers/BookingTarget/TeamTargetController.cs:11
  • UserMarkerController — Pams/API/Pams.API/Controllers/ColorMarker/UserMarkerController.cs:10

…and 211 more.

Was this page helpful?

Download as PDF