Skip to main content

Changelog

All notable changes to SuperAdmin.Rbac. Versions follow SemVer.

0.2.3​

Fixed​

  • The Blazor SuperAdminMenu and SuperAdminLayout wrote absolute links (http://host/admin/sync) for menu items, logout, settings and the logo. They now write root-relative links (/admin/sync, or /base/admin/sync under a path base), the same as the Razor menu. Behind a proxy that terminates HTTPS, links no longer start with http:// when the app does not read the forwarded headers.
  • UI:Stylesheets: local entries (~/... or /..., also their MapStaticAssets() fingerprinted URLs) no longer need a login. With Protection:Scope = All the sign-in page could not load them before.

0.2.2​

Breaking change in a patch version: the Blazor <SuperAdminMenu /> now renders the sidebar markup. Apps that reference 0.2.* get it automatically. For the old list markup, set Variant="SuperAdminMenuVariant.Plain", or pin 0.2.1.

Added​

  • Blazor shell components, so Blazor apps no longer copy the panel markup:
    • SuperAdminLayout: header, user menu (settings, logout with antiforgery token), sidebar with search and menu, page body. Same markup as _AdminLayout.cshtml. Use it as the layout or nest your own layout in it (@layout SuperAdminLayout).
    • <SuperAdminHead />: the theme CSS, superadmin.css, UI:Stylesheets and the colour-mode script for <head>. Fingerprinted paths with MapStaticAssets().
    • <SuperAdminScripts />: the Bootstrap bundle and superadmin.js for <body>.
    • SuperAdminAssets: constants for the package's static file paths.
  • UI:Stylesheets: extra CSS files loaded after the package CSS on the built-in pages, the sign-in page and <SuperAdminHead />.
  • UI:ColorMode = Light (default), Dark or Auto (follows prefers-color-scheme), through Bootstrap's data-bs-theme.
  • Colour variables in the theme: --sa-accent, --sa-sidebar-bg, --sa-sidebar-text, --sa-main-bg, --sa-surface-bg and more (README, "Theme and colours"). Each has a dark value. The old names (--menu-bg, --main-bg, ...) still work.
  • theme/: the SCSS source of styles.css and its build (npm run build).

Changed​

  • Bootstrap 5.3.8 (was 5.1.3), CSS and JS. The theme settings are carried over, so the panel looks the same. New 5.3 classes such as .text-bg-* are available.
  • Breaking: the Blazor <SuperAdminMenu /> now renders the panel's sidebar markup (ul#menu, collapsible groups, li.active), styled by the package CSS. For the 0.2 markup (sa-menu classes, NavLink), set Variant="SuperAdminMenuVariant.Plain".
  • superadmin.js uses handlers delegated from document, so the sidebar toggle, menu search and confirmations keep working after Blazor re-renders.
  • Header, cards, tables and the sign-in page use theme variables instead of fixed white backgrounds, so they follow dark mode.
  • The theme CSS no longer contains rules for third-party widgets the panel does not use (choices.js, flatpickr, toastify, icon picker, dual list box, grid helpers). Font files that were never shipped (.eot, .ttf, .svg) are no longer referenced.

Upgrading from 0.2.1 or earlier​

  1. Blazor apps that styled .sa-menu themselves: add Variant="SuperAdminMenuVariant.Plain" to <SuperAdminMenu />, or switch to SuperAdminLayout.
  2. Blazor apps that copied the panel layout: replace the copied header and sidebar markup with @layout SuperAdminLayout, the hard-coded _content/SuperAdmin.Rbac/... links with <SuperAdminHead /> and <SuperAdminScripts />, and drop local .text-bg-* CSS (now in Bootstrap 5.3).
  3. Brand colours: move them to a stylesheet listed in UI:Stylesheets and use the --sa-* variables.

0.2.0​

Added​

  • Blazor Server support (AddSuperAdminBlazor()):
    • a revalidating AuthenticationStateProvider: deactivation, force logout and password changes also end open circuits (Auth:RevalidationMinutes, default 1);
    • [HasUrlPermission] / policy SuperAdminDefaults.UrlPolicy ("sa:url"): checks permission URL rules on every in-circuit navigation through AuthorizeRouteView. The handler accepts HttpContext, Blazor RouteData, UrlResource or a path string;
    • <SaCan Permission="" Roles="" Url=""> and <SuperAdminMenu /> components;
    • ICurrentAdmin reads the current user on each call inside a circuit.
  • Auth:SetDefaultScheme: makes the SuperAdmin cookie the default scheme for [Authorize], AuthorizeView and HttpContext.User.
  • Database:Mode = Auto | Create | Migrate | None. Startup now fails fast when a plugin table or column is missing.
  • SQL scripts for SQL Server, PostgreSQL, MySQL, Oracle and SQLite: GenerateSuperAdminSqlScript() and, in the package, sql/<provider>/0001_init.sql (install) and 0002_user_attributes.sql (upgrade from 0.1.x). All are safe to run again, and the install script also adds columns of newer versions to existing tables. SQL Server scripts set ANSI_NULLS and QUOTED_IDENTIFIER.
  • Tested on SQL Server (LocalDB), PostgreSQL 17, MySQL 9.1 (MySql.EntityFrameworkCore) and SQLite. Oracle (Oracle.EntityFrameworkCore, 23ai and 19c compatibility) is supported; its scripts and model are covered by checks, not yet by a live database run.
  • Protection:SkipUrlRulesForAssets (default true): MapStaticAssets() files and Blazor framework requests (/_framework/*, /_blazor, /_blazor/*) need login but no URL rule. Before, Protection:Scope = All blocked blazor.web.js for users without a matching rule, so their circuit never started.
  • Command line: RunSuperAdminCommandAsync(args) with superadmin seed-admin and superadmin sql-script.
  • User import: UserInput.PasswordHash (ASP.NET Core Identity v2/v3 hashes), UserInput.Id, UserInput.LockoutEnd.
  • Extra user fields: sa_users.Attributes (JSON), UserInput.Attributes, SaUser.GetAttributes(), AccessSnapshot.Attributes.
  • Events: ISuperAdminEvents (SignedIn, SignInFailed with reason, SignedOut, UserChanged, RoleChanged, PermissionChanged, MenuChanged).
  • IOperationLogSink for your own audit table, and OperationLog:WriteToDatabase.
  • UI:Enabled and UI:Pages (Account, Management, All) to turn built-in pages off.
  • TimeProvider is used for lockout, cookie expiry, rate limit, timestamps and log retention (replace it in tests).
  • Source Link, sources embedded in the symbols (.snupkg) and deterministic CI builds.
  • A Blazor Server sample (samples/Sample.Blazor).

Changed​

  • The plugin uses IDbContextFactory<SuperAdminDbContext> and one short-lived context per operation, so services are safe in Blazor circuits. SuperAdminDbContext can still be injected as a scoped service.
  • All DateTime values are read back as DateTimeKind.Utc.
  • User and permission search is case-insensitive on every database (it was case-sensitive on PostgreSQL).
  • Oracle: sa_permission_routes.HttpMethods is nullable (Oracle stores '' as NULL), and strings without a maximum length are NCLOB instead of NVARCHAR2(2000). Importing users with explicit ids moves the Oracle identity forward.
  • The generated admin password is no longer logged. Without Seed:AdminPassword, Development prints a random password to the console; other environments create no admin user (use superadmin seed-admin).
  • Database:AutoMigrate is obsolete; false still works and means Mode = None.

Fixed​

  • The login page treated a revoked session (stale security stamp) as signed in, redirected to the dashboard and lost returnUrl. It now clears the stale cookie and shows the form.

Upgrading from 0.1.x​

  1. Database: 0.2.0 adds the nullable column sa_users.Attributes.
    • Mode Auto/Create without migrations: added automatically at startup.
    • EF Core migrations: dotnet ef migrations add SuperAdmin020 --context SuperAdminDbContext.
    • SQL scripts: run sql/<provider>/0002_user_attributes.sql from the package, or regenerate and re-run GenerateSuperAdminSqlScript(). Until the column exists, Mode = None stops the app with "missing sa_users.Attributes".
  2. 0.1.x wrote the generated admin password to the application log. If you ran 0.1.x without Seed:AdminPassword, change that admin password and remove the line from stored logs.
  3. Production: set SuperAdmin:Seed:AdminPassword (or run superadmin seed-admin) before the first start on an empty database.
  4. If you construct the management services yourself (not through DI), pass the new constructor arguments.

0.1.0.1, 0.1.0​

First releases. Both write a generated admin password to the log; use 0.2.0 or later. 0.1.0.1 is a four-part version; later releases use three-part SemVer.