├── .editorconfig ├── .eslintrc.json ├── .github └── ISSUE_TEMPLATE │ ├── Bug_Report.yml │ ├── Feature_Request.yml │ ├── config.yml │ └── translation_issue.yml ├── .gitignore ├── .markdownlint.json ├── .vscode ├── launch.json ├── settings.json ├── solution-explorer │ ├── class.cs-template │ ├── class.ts-template │ ├── class.vb-template │ ├── default.ts-template │ ├── enum.cs-template │ ├── interface.cs-template │ ├── interface.ts-template │ ├── template-list.json │ └── template-parameters.js └── tasks.json ├── .wakatime-project ├── .whitesource ├── LICENSE ├── Readme.md ├── SoftinuxBase.sln ├── SoftinuxBase.sln.DotSettings ├── StyleCopRules.ruleset ├── TestsWatchers ├── SecurityPermissionsTestsWatcher.bat ├── SecurityPermissionsTestsWatcher.sh ├── SecurityTestWatcher.bat └── SecurityTestWatcher.sh ├── appveyor.yml ├── bp.bat ├── bp.ps1 ├── bp.sh ├── bundleconfig.json ├── dependencies.txt ├── documentation.props ├── editorconfig ├── extensions.txt ├── global.json ├── gulpfile.js ├── issue_template.md ├── omnisharp.json ├── package.json ├── pull_request_template.md ├── rest_query.http ├── screenshots ├── grant_global_permissions_wip.png ├── login.png ├── menu_and_administration.png └── user_profile.png ├── sdk.sh ├── src ├── Globalisation │ └── Globalisation.csproj ├── SoftinuxBase.Barebone │ ├── Actions │ │ ├── UseAuthorizationAction.cs │ │ └── UseEndpointsAction.cs │ ├── Controllers │ │ ├── AboutController.cs │ │ └── BareboneController.cs │ ├── ExtensionMetadata.cs │ ├── Extensions │ │ └── ModelStateExtensions.cs │ ├── Fonts │ │ ├── 6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7jsDJT9g.woff2 │ │ ├── 6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7ksDJT9g.woff2 │ │ ├── 6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7nsDI.woff2 │ │ ├── 6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7osDJT9g.woff2 │ │ ├── 6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7psDJT9g.woff2 │ │ ├── 6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7qsDJT9g.woff2 │ │ ├── 6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7rsDJT9g.woff2 │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qN67lqDY.woff2 │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qNK7lqDY.woff2 │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qNa7lqDY.woff2 │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qNq7lqDY.woff2 │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qO67lqDY.woff2 │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7l.woff2 │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qPK7lqDY.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdg18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdh18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdi18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdj18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdo18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCds18Q.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdv18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidg18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidh18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidi18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidj18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkido18Smxg.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkids18Q.woff2 │ │ ├── 6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidv18Smxg.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwkxduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlBduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlxdu.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmBduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmRduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmhduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmxduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwkxduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlBduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdu.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmBduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmRduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmhduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmxduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwkxduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlBduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdu.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmBduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmRduz8A.woff2 │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmhduz8A.woff2 │ │ └── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmxduz8A.woff2 │ ├── Scripts │ │ ├── CustomLogging.js │ │ ├── _references.js │ │ ├── barebone.js │ │ ├── barebone_ajax.js │ │ ├── barebone_press_and_hold.js │ │ ├── infrastructure.js │ │ └── toolbox.js │ ├── SoftinuxBase.Barebone.csproj │ ├── Styles │ │ └── scss │ │ │ ├── _barebone.scss │ │ │ ├── _fonts.scss │ │ │ └── index.scss │ ├── Tools │ │ └── HtmlHelperExtension.cs │ ├── ViewComponents │ │ ├── MenuViewComponent.cs │ │ ├── ScriptsViewComponent.cs │ │ ├── StyleSheetsViewComponent.cs │ │ └── ViewComponentBase.cs │ ├── ViewModels │ │ ├── Barebone │ │ │ ├── IndexViewModel.cs │ │ │ └── IndexViewModelFactory.cs │ │ ├── ErrorViewModel.cs │ │ ├── Shared │ │ │ ├── Menu │ │ │ │ ├── MenuViewModel.cs │ │ │ │ └── MenuViewModelFactory.cs │ │ │ ├── MenuGroup │ │ │ │ ├── MenuGroupViewModel.cs │ │ │ │ └── MenuGroupViewModelFactory.cs │ │ │ ├── MenuItem │ │ │ │ ├── MenuItemViewModel.cs │ │ │ │ └── MenuitemViewModelFactory.cs │ │ │ ├── Script │ │ │ │ ├── ScriptViewModel.cs │ │ │ │ └── ScriptViewModelFactory.cs │ │ │ ├── Scripts │ │ │ │ ├── ScriptsViewModel.cs │ │ │ │ └── ScriptsViewModelFactory.cs │ │ │ ├── StyleSheet │ │ │ │ ├── StyleSheetViewModel.cs │ │ │ │ └── StyleSheetViewModelFactory.cs │ │ │ └── StyleSheets │ │ │ │ ├── StyleSheetsViewModel.cs │ │ │ │ └── StyleSheetsViewModelFactory.cs │ │ └── ViewModelFactoryBase.cs │ └── Views │ │ ├── About │ │ └── Index.cshtml │ │ ├── Barebone │ │ └── Index.cshtml │ │ ├── Shared │ │ ├── Components │ │ │ ├── Menu │ │ │ │ └── Default.cshtml │ │ │ ├── Scripts │ │ │ │ └── Default.cshtml │ │ │ └── StyleSheets │ │ │ │ └── Default.cshtml │ │ ├── Error.cshtml │ │ ├── _CodeEditor.cshtml │ │ ├── _CodeEditorScript.cshtml │ │ ├── _Footer.cshtml │ │ ├── _IsDebugBanner.cshtml │ │ ├── _Layout.cshtml │ │ ├── _Menu.cshtml │ │ ├── _MenuGroup.cshtml │ │ ├── _MenuItem.cshtml │ │ ├── _Navbar.cshtml │ │ ├── _Script.cshtml │ │ ├── _Scripts.cshtml │ │ ├── _Sidebar.cshtml │ │ ├── _StyleSheet.cshtml │ │ └── _StyleSheets.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml ├── SoftinuxBase.Bundles │ └── SoftinuxBase.Bundles.csproj ├── SoftinuxBase.Data.Sqlite │ └── SoftinuxBase.Data.Sqlite.csproj ├── SoftinuxBase.Infrastructure │ ├── AspNetRolesManager.cs │ ├── ControllerBase.cs │ ├── CorporateConfiguration.cs │ ├── FontAwesomeIcon.cs │ ├── HtmlExtensions.cs │ ├── Interfaces │ │ ├── IAspNetRolesManager.cs │ │ └── IExtensionMetadata.cs │ ├── MenuGroup.cs │ ├── MenuItem.cs │ ├── Script.cs │ ├── SoftinuxBase.Infrastructure.csproj │ ├── SqlHelper.cs │ ├── StyleSheet.cs │ └── Tools │ │ └── StringExtensions.cs ├── SoftinuxBase.Security.AuthorizeSetup │ ├── AddClaimsToCookie.cs │ ├── AddPermissionsDataKeyToUserClaims.cs │ ├── AddPermissionsToUserClaims.cs │ ├── AuthCookieValidateEverything.cs │ ├── AuthCookieValidateImpersonation.cs │ ├── AuthCookieValidatePermissionsDataKey.cs │ ├── AuthCookieValidatePermissionsOnly.cs │ ├── AuthCookieValidateRefreshClaims.cs │ ├── IAuthCookieValidate.cs │ ├── PermissionsSetupOptions.cs │ └── SoftinuxBase.Security.AuthorizeSetup.csproj ├── SoftinuxBase.Security.Data.Abstractions │ ├── IAspNetUsersRepository.cs │ ├── IRoleToPermissionsRepository.cs │ ├── IUserToRoleRepository.cs │ └── SoftinuxBase.Security.Data.Abstractions.csproj ├── SoftinuxBase.Security.Data.Entities │ ├── ExtraAuthConstants.cs │ ├── IAddRemoveEffectsUser.cs │ ├── IChangeEffectsUser.cs │ ├── ModulesForUser.cs │ ├── NoQueryFilterNeeded.cs │ ├── RoleToPermissions.cs │ ├── SoftinuxBase.Security.Data.Entities.csproj │ ├── TimeStore.cs │ ├── User.cs │ └── UserToRole.cs ├── SoftinuxBase.Security.Data.EntityFramework.Mssql │ └── SoftinuxBase.Security.Data.EntityFramework.Mssql.csproj ├── SoftinuxBase.Security.Data.EntityFramework.Mysql │ └── SoftinuxBase.Security.Data.EntityFramework.Mysql.csproj ├── SoftinuxBase.Security.Data.EntityFramework.Npgsql │ └── SoftinuxBase.Security.Data.EntityFramework.Npgsql.csproj ├── SoftinuxBase.Security.Data.EntityFramework.Sqlite │ └── SoftinuxBase.Security.Data.EntityFramework.Sqlite.csproj ├── SoftinuxBase.Security.Data.EntityFramework │ ├── ApplicationStorageContext.cs │ ├── AspNetUsersRepository.cs │ ├── ChangeExtensions.cs │ ├── ConfigExtensions.cs │ ├── EfLoggerProvider.cs │ ├── EntityRegistrar.cs │ ├── RoleToPermissionsRepository.cs │ ├── SoftinuxBase.Security.Data.EntityFramework.csproj │ └── UserToRoleRepository.cs ├── SoftinuxBase.Security.FeatureAuthorize │ ├── CalcFeaturePermissions.cs │ ├── ClaimsExtensions.cs │ ├── Extensions │ │ └── UserExtensions.cs │ ├── PermissionConstants.cs │ ├── PolicyCode │ │ ├── AuthorizationPolicyProvider.cs │ │ ├── HasPermissionAttribute.cs │ │ ├── PermissionHandler.cs │ │ └── PermissionRequirement.cs │ └── SoftinuxBase.Security.FeatureAuthorize.csproj ├── SoftinuxBase.Security.Permissions │ ├── Attributes │ │ └── PasswordAttributes.cs │ ├── DictionaryExtensions.cs │ ├── Enums │ │ ├── ClaimType.cs │ │ └── Permissions.cs │ ├── LinkedToModuleAttribute.cs │ ├── PaidForModules.cs │ ├── PermissionDisplay.cs │ ├── PermissionsDictionary.cs │ ├── SoftinuxBase.Security.Permissions.csproj │ ├── StringExtensions.cs │ └── TypeExtensions.cs ├── SoftinuxBase.Security.RefreshClaims │ ├── AuthChanges.cs │ ├── AuthChangesConsts.cs │ ├── IAuthChanges.cs │ ├── ITimeStore.cs │ └── SoftinuxBase.Security.RefreshClaims.csproj ├── SoftinuxBase.Security.UserImpersonation │ ├── AppStart │ │ └── StartupExtensions.cs │ ├── Concrete │ │ ├── AuthCookieSignout.cs │ │ ├── ImpersonationCookie.cs │ │ ├── ImpersonationData.cs │ │ ├── ImpersonationHandler.cs │ │ └── ImpersonationService.cs │ ├── IImpersonationService.cs │ ├── ImpersonateExtensions.cs │ └── SoftinuxBase.Security.UserImpersonation.csproj ├── SoftinuxBase.Security │ ├── Controllers │ │ ├── AccountController.cs │ │ ├── AdministrationController.cs │ │ ├── GrantPermissionsController.cs │ │ └── ListUsersController.cs │ ├── ExtensionMetadata.cs │ ├── MD5Hasher.cs │ ├── Scripts │ │ ├── security_edit_user.js │ │ ├── security_user.js │ │ └── security_user_permissions.js │ ├── ServiceConfiguration │ │ ├── ActivateAuthentication.cs │ │ ├── ConfigureAction.cs │ │ ├── ConfigureAuthentication.cs │ │ └── ConfigureServicesAction.cs │ ├── SoftinuxBase.Security.csproj │ ├── Styles │ │ └── scss │ │ │ └── index.scss │ ├── Tools │ │ ├── CreateRole.cs │ │ ├── DeleteRole.cs │ │ ├── ReadGrants.cs │ │ ├── RegisterUser.cs │ │ ├── UpdateRole.cs │ │ └── UpdateRoleAndGrants.cs │ ├── ViewComponents │ │ ├── AddRoleListExtensionsViewComponent.cs │ │ ├── EditRolePermissionsViewComponent.cs │ │ ├── GrantPermissionsViewComponent.cs │ │ └── SelectOptionsListRolesViewComponent.cs │ ├── ViewModels │ │ ├── Account │ │ │ ├── CreateOrEditUserViewModel.cs │ │ │ ├── SignInViewModel.cs │ │ │ └── SignUpViewModel.cs │ │ └── Permissions │ │ │ ├── DeleteRoleExtensionLinkViewModel.cs │ │ │ ├── ExtensionPermissionValue.cs │ │ │ ├── GrantViewModel.cs │ │ │ ├── ReadRoleViewModel.cs │ │ │ ├── SaveNewRoleViewModel.cs │ │ │ ├── SelectablePermissionDisplay.cs │ │ │ ├── SelectedExtension.cs │ │ │ ├── UpdateRolePermissionViewModel.cs │ │ │ └── UpdateRoleViewModel.cs │ ├── Views │ │ ├── Account │ │ │ ├── AccessDenied.cshtml │ │ │ ├── SignIn.cshtml │ │ │ ├── SignUp.cshtml │ │ │ └── User.cshtml │ │ ├── Administration │ │ │ └── Administration.cshtml │ │ ├── GrantPermissions │ │ │ └── Index.cshtml │ │ ├── ListUsers │ │ │ ├── Admin_Edit_User.cshtml │ │ │ └── ListUsers.cshtml │ │ └── Shared │ │ │ ├── Components │ │ │ ├── AddRoleListExtensions │ │ │ │ └── _AddRoleListExtensions.cshtml │ │ │ ├── EditRolePermissions │ │ │ │ └── _Edit_Role_Permissions.cshtml │ │ │ ├── GrantPermissions │ │ │ │ └── _List_Roles_Extensions.cshtml │ │ │ └── SelectOptionsListRoles │ │ │ │ └── _SelectOptionsListRoles.cshtml │ │ │ ├── _Layout_Edit_User_Admin.cshtml │ │ │ ├── _ListClaims.cshtml │ │ │ ├── _UserBadge.cshtml │ │ │ ├── _User_Profile_Details.cshtml │ │ │ ├── _User_Profile_Details_Card.cshtml │ │ │ └── _User_Profile_Details_Fields.cshtml │ └── bundleconfig.json.bindings ├── SoftinuxBase.SeedDatabase │ ├── Constants.cs │ ├── Controllers │ │ └── SeedDatabaseController.cs │ ├── ExtensionMetadata.cs │ └── SoftinuxBase.SeedDatabase.csproj ├── SoftinuxBase.WebApplication │ ├── ApplicationBuilderExtensions.cs │ ├── RequestResponseLoggingMiddleware.cs │ ├── RequestResponseLoggingMiddlewareExtensions.cs │ ├── ServiceCollectionExtensions.cs │ └── SoftinuxBase.WebApplication.csproj ├── Testing │ ├── Extensions │ │ ├── SampleExtension1 │ │ │ ├── ExtensionMetadata.cs │ │ │ ├── SampleExtension1.csproj │ │ │ └── SamplePermissions.cs │ │ ├── SampleExtension2 │ │ │ ├── ExtensionMetadata.cs │ │ │ ├── SampleExtension2.csproj │ │ │ └── SamplePermissions2.cs │ │ └── SampleExtension3 │ │ │ ├── ExtensionMetadata.cs │ │ │ └── SampleExtension3.csproj │ ├── Integration │ │ ├── cypress.json │ │ ├── package.json │ │ ├── screenshots │ │ │ └── .gitkeep │ │ ├── src │ │ │ ├── Fixtures │ │ │ │ └── .gitkeep │ │ │ ├── Integration │ │ │ │ └── spec.ts │ │ │ ├── Plugins │ │ │ │ └── index.js │ │ │ └── Support │ │ │ │ ├── commands.ts │ │ │ │ └── index.ts │ │ ├── tsconfig.json │ │ ├── tslint.json │ │ ├── videos │ │ │ └── .gitkeep │ │ └── webpack.config.js │ └── Unit │ │ ├── SoftinuxBase.Security.PermissionsTests │ │ ├── DictionaryExtensionsTests.cs │ │ ├── PermissionDisplayTest.cs │ │ ├── PermissionsDictionaryTest.cs │ │ ├── SoftinuxBase.Security.PermissionsTests.csproj │ │ ├── StringExtensionsTests.cs │ │ └── TypeExtensionsTest.cs │ │ ├── SoftinuxBase.SecurityTests │ │ ├── CreateRoleTest.cs │ │ ├── DeleteRoleTest.cs │ │ ├── Fakes │ │ │ └── ExtensionManager.cs │ │ ├── Mocks │ │ │ └── RoleToPermissionsRepositoryMock.cs │ │ ├── ReadGrantsTest.cs │ │ ├── SoftinuxBase.SecurityTests.csproj │ │ ├── StringExtensionsTest.cs │ │ ├── UpdateRoleAndGrantsTest.cs │ │ └── UpdateRoleTest.cs │ │ └── SoftinuxBase.Tests.Common │ │ ├── Constants.cs │ │ ├── OtherPermissions.cs │ │ ├── Roles.cs │ │ ├── SoftinuxBase.Tests.Common.csproj │ │ └── Utilities.cs ├── WebApplication │ ├── Extensions │ │ └── .gitkeep │ ├── Migrations │ │ ├── 20200409092423_InitialCreate.Designer.cs │ │ ├── 20200409092423_InitialCreate.cs │ │ └── ApplicationStorageContextModelSnapshot.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── WebApplication.csproj │ ├── appsettings.development.json │ ├── appsettings.json │ ├── appsettings.production.json │ └── web.config └── wwwroot │ ├── css │ └── Styles.css │ ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ └── fontawesome-webfont.woff2 │ └── img │ ├── login_page_background.png │ ├── profile-circle2-128.png │ ├── softinux_logo-bg-transparent.png │ └── softinux_logo-bg-transparent30x30.png └── stylecop.json /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es6": true, 5 | "jquery": true 6 | }, 7 | "extends": [ 8 | "standard" 9 | ], 10 | "globals": { 11 | "Atomics": "readonly", 12 | "SharedArrayBuffer": "readonly" 13 | }, 14 | "parserOptions": { 15 | "ecmaVersion": 2021, 16 | "sourceType": "module" 17 | }, 18 | "rules": { 19 | "semi": ["error", "always"], // https://eslint.org/docs/rules/semi 20 | "indent": ["error", 4, { "SwitchCase": 1 }], 21 | "no-tabs":"off", 22 | "curly":"off", 23 | "space-before-function-paren":"off" 24 | } 25 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug_Report.yml: -------------------------------------------------------------------------------- 1 | name: "Bug report 🐛" 2 | description: Report errors or unexpected behavior 3 | labels: ["Needs-Triage "] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | > **Important: When reporting bug or security issues, DO NOT attach any critical information like secret keys**. 9 | > 10 | > Please use this form and describe your issue, concisely but precisely, with as much detail as possible. 11 | - type: textarea 12 | attributes: 13 | label: Brief description of your issue 14 | placeholder: Briefly describe your issue here. 15 | validations: 16 | required: true 17 | - type: textarea 18 | attributes: 19 | label: Steps to reproduce 20 | placeholder: A description of how to trigger this bug 21 | validations: 22 | required: true 23 | - type: textarea 24 | attributes: 25 | label: Expected behavior 26 | placeholder: What did you expect to happen? 27 | validations: 28 | required: true 29 | - type: textarea 30 | attributes: 31 | label: Actual behavior 32 | placeholder: What is currently happening? 33 | validations: 34 | required: true 35 | - type: textarea 36 | attributes: 37 | label: Environment 38 | placeholder: | 39 | [dotnet --info] 40 | [dotnet ef --version] 41 | 42 | Any other software? 43 | render: shell 44 | validations: 45 | required: true 46 | - type: dropdown 47 | id: browsers 48 | attributes: 49 | label: What browsers are you seeing the problem on? 50 | multiple: true 51 | options: 52 | - Firefox 53 | - Chrome 54 | - Safari 55 | - Microsoft Edge 56 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feature_Request.yml: -------------------------------------------------------------------------------- 1 | name: "Feature Request/Idea 🚀" 2 | description: Suggest a new feature or improvement (this does not mean you have to implement it) 3 | labels: ["Issue-Feature"] 4 | body: 5 | - type: textarea 6 | attributes: 7 | label: Description of the new feature / enhancement 8 | placeholder: | 9 | A clear and concise description of what the problem is that the new feature would solve. 10 | Describe why and how a user would use this new functionality (if applicable). 11 | validations: 12 | required: true 13 | - type: textarea 14 | attributes: 15 | label: Proposed technical implementation details 16 | placeholder: A clear and concise description of what you want to happen 17 | validations: 18 | required: false 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Review open issues 4 | url: https://github.com/SOFTINUX/Base/issues 5 | about: Please check if your issue or a similar issue has already been submitted. 6 | - name: General Question 7 | url: https://github.com/SOFTINUX/Base/discussions/new 8 | about: Have a question on something? Start a new discussion thread. 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/translation_issue.yml: -------------------------------------------------------------------------------- 1 | name: "🌐 Localization/Translation issue" 2 | description: Report incorrect translations. 3 | labels: 4 | - Area-Localization 5 | - Issue-Translation 6 | - Needs-Triage 7 | body: 8 | - type: markdown 9 | attributes: 10 | value: Please make sure to [search for existing issues](https://github.com/SOFTINUX/Base/issues) before filing a new one! 11 | - type: input 12 | attributes: 13 | label: 🌐 Language affected 14 | placeholder: "French" 15 | validations: 16 | required: true 17 | - type: textarea 18 | attributes: 19 | label: ❌ Actual phrase(s) 20 | placeholder: What is there? Please include a screenshot as that is extremely helpful. 21 | validations: 22 | required: true 23 | - type: textarea 24 | attributes: 25 | label: ✔️ Expected phrase(s) 26 | placeholder: What was expected? 27 | validations: 28 | required: true 29 | - type: textarea 30 | attributes: 31 | label: ℹ Why is the current translation wrong 32 | placeholder: Why do you feel this is incorrect? 33 | validations: 34 | required: true -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "MD001": false, 4 | "MD003": { "style": "atx" }, 5 | "MD007": { "indent": 4 }, 6 | "MD013": false, 7 | "MD025": false, 8 | "MD026": false, 9 | "MD033": false, 10 | "MD045": false, 11 | "no-hard-tabs": false 12 | } -------------------------------------------------------------------------------- /.vscode/solution-explorer/class.cs-template: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace {{namespace}} 7 | { 8 | public class {{name}} 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.vscode/solution-explorer/class.ts-template: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | export class {{name}} { 5 | 6 | } -------------------------------------------------------------------------------- /.vscode/solution-explorer/class.vb-template: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | Imports System 5 | 6 | Namespace {{namespace}} 7 | 8 | Public Class {{name}} 9 | 10 | End Class 11 | 12 | End Namespace 13 | -------------------------------------------------------------------------------- /.vscode/solution-explorer/default.ts-template: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | export default {{name}} { 5 | 6 | } -------------------------------------------------------------------------------- /.vscode/solution-explorer/enum.cs-template: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace {{namespace}} 7 | { 8 | public enum {{name}} 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.vscode/solution-explorer/interface.cs-template: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace {{namespace}} 7 | { 8 | public interface {{name}} 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.vscode/solution-explorer/interface.ts-template: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | export interface {{name}} { 5 | 6 | } -------------------------------------------------------------------------------- /.vscode/solution-explorer/template-list.json: -------------------------------------------------------------------------------- 1 | { 2 | "templates": [ 3 | { 4 | "name": "Class", 5 | "extension": "cs", 6 | "file": "./class.cs-template", 7 | "parameters": "./template-parameters.js" 8 | }, 9 | { 10 | "name": "Interface", 11 | "extension": "cs", 12 | "file": "./interface.cs-template", 13 | "parameters": "./template-parameters.js" 14 | }, 15 | { 16 | "name": "Enum", 17 | "extension": "cs", 18 | "file": "./enum.cs-template", 19 | "parameters": "./template-parameters.js" 20 | }, 21 | { 22 | "name": "Class", 23 | "extension": "ts", 24 | "file": "./class.ts-template", 25 | "parameters": "./template-parameters.js" 26 | }, 27 | { 28 | "name": "Interface", 29 | "extension": "ts", 30 | "file": "./interface.ts-template", 31 | "parameters": "./template-parameters.js" 32 | }, 33 | { 34 | "name": "Default", 35 | "extension": "ts", 36 | "file": "./default.ts-template", 37 | "parameters": "./template-parameters.js" 38 | }, 39 | { 40 | "name": "Class", 41 | "extension": "vb", 42 | "file": "./class.vb-template", 43 | "parameters": "./template-parameters.js" 44 | } 45 | ] 46 | } -------------------------------------------------------------------------------- /.vscode/solution-explorer/template-parameters.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | 3 | module.exports = function(filename, projectPath, folderPath) { 4 | var namespace = "Unknown"; 5 | if (projectPath) { 6 | namespace = path.basename(projectPath, path.extname(projectPath)); 7 | if (folderPath) { 8 | namespace += "." + folderPath.replace(path.dirname(projectPath), "").substring(1).replace(/[\\\/]/g, "."); 9 | } 10 | } 11 | 12 | return { 13 | namespace: namespace, 14 | name: path.basename(filename, path.extname(filename)) 15 | } 16 | }; -------------------------------------------------------------------------------- /.wakatime-project: -------------------------------------------------------------------------------- 1 | SOFTINUX Base -------------------------------------------------------------------------------- /.whitesource: -------------------------------------------------------------------------------- 1 | { 2 | "generalSettings": { 3 | "shouldScanRepo": true 4 | }, 5 | "scanSettings": { 6 | "configMode": "AUTO", 7 | "configExternalURL": "" 8 | }, 9 | "checkRunSettings": { 10 | "vulnerableCheckRunConclusionLevel": "failure" 11 | }, 12 | "issueSettings": { 13 | "minSeverityLevel": "LOW" 14 | } 15 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 SOFTINUX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /StyleCopRules.ruleset: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /TestsWatchers/SecurityPermissionsTestsWatcher.bat: -------------------------------------------------------------------------------- 1 | dotnet watch --project ..\src\Testing\Unit\SoftinuxBase.Security.PermissionsTests\SoftinuxBase.Security.PermissionsTests.csproj test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info -------------------------------------------------------------------------------- /TestsWatchers/SecurityPermissionsTestsWatcher.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | dotnet watch --project ../src/Testing/Unit/SoftinuxBase.Security.PermissionsTests/SoftinuxBase.Security.PermissionsTests.csproj test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info -------------------------------------------------------------------------------- /TestsWatchers/SecurityTestWatcher.bat: -------------------------------------------------------------------------------- 1 | dotnet watch --project ..\src\Testing\Unit\SoftinuxBase.SecurityTests\SoftinuxBase.SecurityTests.csproj test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info -------------------------------------------------------------------------------- /TestsWatchers/SecurityTestWatcher.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | dotnet watch --project ../src/Testing/Unit/SoftinuxBase.SecurityTests/SoftinuxBase.SecurityTests.csproj test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.0.{build}-{branch} 2 | pull_requests: 3 | do_not_increment_build_number: true 4 | branches: 5 | only: 6 | - NewPermissionsSystem-Admin 7 | image: Ubuntu 8 | clone_folder: /home/appveyor/projects/base/ 9 | environment: 10 | nodejs_version: 12.18.3 11 | install: 12 | - sh: >- 13 | nvm install $nodejs_version 14 | 15 | npm install --loglevel=error # no warnings 16 | build: 17 | verbosity: minimal 18 | test_script: 19 | - sh: dotnet test --no-build 20 | -------------------------------------------------------------------------------- /bundleconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "outputFileName": "src/SoftinuxBase.Barebone/Scripts/barebone.min.js", 4 | "inputFiles": [ 5 | "src/SoftinuxBase.Barebone/Scripts/barebone.js", 6 | "src/SoftinuxBase.Barebone/Scripts/infrastructure.js", 7 | "src/SoftinuxBase.Barebone/Scripts/barebone_press_and_hold.js", 8 | "src/SoftinuxBase.Barebone/Scripts/CustomLogging.js", 9 | "src/SoftinuxBase.Barebone/Scripts/toolbox.js", 10 | "src/SoftinuxBase.Barebone/Scripts/barebone_ajax.js" 11 | ], 12 | "minify": { 13 | "enabled": false, 14 | "renameLocals": true 15 | }, 16 | "sourceMap": true 17 | }, 18 | { 19 | "outputFileName": "src/SoftinuxBase.Security/Scripts/security.min.js", 20 | "inputFiles": [ 21 | "src/SoftinuxBase.Security/Scripts/security_user.js", 22 | "src/SoftinuxBase.Security/Scripts/security_edit_user.js", 23 | "src/SoftinuxBase.Security/Scripts/security_user_permissions.js" 24 | ], 25 | "minify": { 26 | "enabled": false, 27 | "renameLocals": true 28 | }, 29 | "sourceMap": true 30 | } 31 | ] 32 | -------------------------------------------------------------------------------- /dependencies.txt: -------------------------------------------------------------------------------- 1 | src\SoftinuxBase.Security.Data.EntityFramework.Sqlite\bin\Debug\net5.0\SoftinuxBase.Security.Data.EntityFramework.Sqlite.dll 2 | src\SoftinuxBase.Security.Data.EntityFramework\bin\Debug\net5.0\SoftinuxBase.Security.Data.EntityFramework.dll 3 | src\SoftinuxBase.Security.Data.Entities\bin\Debug\net5.0\SoftinuxBase.Security.Data.Entities.dll 4 | src\SoftinuxBase.Security.Data.Abstractions\bin\Debug\net5.0\SoftinuxBase.Security.Data.Abstractions.dll 5 | src\SoftinuxBase.Security\bin\Debug\net5.0\SoftinuxBase.Security.dll 6 | src\SoftinuxBase.Infrastructure\bin\Debug\net5.0\SoftinuxBase.Infrastructure.dll 7 | src\SoftinuxBase.Barebone\bin\Debug\net5.0\SoftinuxBase.Barebone.dll 8 | src\WebApplication\appsettings.json 9 | src\WebApplication\basedb.sqlite 10 | -------------------------------------------------------------------------------- /documentation.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | $(BaseOutputPath)bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml 4 | 1701;1702;1591 5 | 6 | 7 | 8 | $(BaseOutputPath)bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml 9 | 1701;1702;1591 10 | 11 | -------------------------------------------------------------------------------- /extensions.txt: -------------------------------------------------------------------------------- 1 | src\SoftinuxBase.SeedDatabase\bin\Debug\net7.0\SoftinuxBase.SeedDatabase.dll 2 | -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "5.0", 4 | "rollForward": "latestMajor", 5 | "allowPrerelease": false 6 | } 7 | } -------------------------------------------------------------------------------- /issue_template.md: -------------------------------------------------------------------------------- 1 | ## Environment data 2 | `dotnet --info` output: 3 | 4 | ## Steps to reproduce 5 | 6 | 7 | ## Expected behavior 8 | 9 | 10 | ## Actual behavior 11 | -------------------------------------------------------------------------------- /pull_request_template.md: -------------------------------------------------------------------------------- 1 | Fixes # . 2 | 3 | Changes proposed in this pull request: 4 | - 5 | - 6 | - 7 | 8 | @SOFTINUX/softinux-developers -------------------------------------------------------------------------------- /rest_query.http: -------------------------------------------------------------------------------- 1 | POST https://localhost:5001/dev/seed/create-user HTTP/1.1 2 | Accept: */* 3 | Cache-Control: no-cache 4 | 5 | ### 6 | 7 | GET https://localhost:5001/dev/seed/ HTTP/1.1 8 | Accept: */* 9 | Cache-Control: no-cache 10 | 11 | ### 12 | 13 | -------------------------------------------------------------------------------- /screenshots/grant_global_permissions_wip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/screenshots/grant_global_permissions_wip.png -------------------------------------------------------------------------------- /screenshots/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/screenshots/login.png -------------------------------------------------------------------------------- /screenshots/menu_and_administration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/screenshots/menu_and_administration.png -------------------------------------------------------------------------------- /screenshots/user_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/screenshots/user_profile.png -------------------------------------------------------------------------------- /src/Globalisation/Globalisation.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | 6 | 7 | 8 | 11 9 | ..\..\StyleCopRules.ruleset 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | all 19 | runtime; build; native; contentfiles; analyzers 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Actions/UseAuthorizationAction.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using ExtCore.Infrastructure.Actions; 6 | using Microsoft.AspNetCore.Builder; 7 | 8 | namespace SoftinuxBase.Barebone.Actions 9 | { 10 | public class UseAuthorizationAction : IConfigureAction 11 | { 12 | /// 13 | public int Priority => 10001; 14 | 15 | /// 16 | public void Execute(IApplicationBuilder applicationBuilder_, IServiceProvider serviceProvider_) 17 | { 18 | applicationBuilder_.UseAuthorization(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Actions/UseEndpointsAction.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using ExtCore.Mvc.Infrastructure.Actions; 6 | using Microsoft.AspNetCore.Builder; 7 | using Microsoft.AspNetCore.Routing; 8 | 9 | namespace SoftinuxBase.Barebone.Actions 10 | { 11 | public class UseEndpointsAction : IUseEndpointsAction 12 | { 13 | /// 14 | public int Priority => 100; 15 | 16 | /// 17 | public void Execute(IEndpointRouteBuilder endpointRouteBuilder_, IServiceProvider serviceProvider_) 18 | { 19 | endpointRouteBuilder_.MapControllerRoute("Default", "{controller}/{action}", new { controller = "Barebone", action = "Index" }); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Controllers/AboutController.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace SoftinuxBase.Barebone.Controllers 8 | { 9 | public class AboutController : Controller 10 | { 11 | /// 12 | /// Index about view. 13 | /// 14 | /// About view. 15 | [HttpGet] 16 | [ActionName("Index")] 17 | public async Task IndexAsync() 18 | { 19 | return await Task.Run(() => View()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Extensions/ModelStateExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using Microsoft.AspNetCore.Mvc.ModelBinding; 7 | 8 | namespace SoftinuxBase.Barebone.Extensions 9 | { 10 | public static class ModelStateExtensions 11 | { 12 | public static IEnumerable<(string, string)> AllErrors(this ModelStateDictionary modelState_) 13 | { 14 | var result = new List<(string, string)>(); 15 | var erroneousFields = modelState_.Where(ms_ => ms_.Value.Errors.Any()) 16 | .Select(x_ => new { x_.Key, x_.Value.Errors }); 17 | 18 | foreach (var erroneousField in erroneousFields) 19 | { 20 | var fieldKey = erroneousField.Key; 21 | var fieldErrors = erroneousField.Errors 22 | .Select(error_ => (fieldKey, error_.ErrorMessage)); 23 | result.AddRange(fieldErrors); 24 | } 25 | 26 | return result; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7jsDJT9g.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7jsDJT9g.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7ksDJT9g.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7ksDJT9g.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7nsDI.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7nsDI.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7osDJT9g.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7osDJT9g.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7psDJT9g.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7psDJT9g.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7qsDJT9g.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7qsDJT9g.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7rsDJT9g.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7rsDJT9g.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qN67lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qN67lqDY.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNK7lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNK7lqDY.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNa7lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNa7lqDY.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNq7lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNq7lqDY.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qO67lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qO67lqDY.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7l.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7l.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qPK7lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qPK7lqDY.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdg18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdg18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdh18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdh18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdi18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdi18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdj18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdj18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdo18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdo18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCds18Q.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCds18Q.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdv18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCdv18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidg18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidg18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidh18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidh18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidi18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidi18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidj18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidj18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkido18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkido18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkids18Q.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkids18Q.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidv18Smxg.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkidv18Smxg.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwkxduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwkxduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlBduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlBduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlxdu.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlxdu.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmBduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmBduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmRduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmRduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmhduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmhduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmxduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmxduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwkxduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwkxduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlBduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlBduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdu.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdu.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmBduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmBduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmRduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmRduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmhduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmhduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmxduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmxduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwkxduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwkxduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlBduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlBduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdu.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdu.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmBduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmBduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmRduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmRduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmhduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmhduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmxduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SOFTINUX/Base/d75103df050cde06fdcf1fd6afb21e6d90e557eb/src/SoftinuxBase.Barebone/Fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmxduz8A.woff2 -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Scripts/_references.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Styles/scss/index.scss: -------------------------------------------------------------------------------- 1 | @use "barebone"; 2 | @use "fonts"; -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Tools/HtmlHelperExtension.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.Mvc.Rendering; 5 | 6 | namespace SoftinuxBase.Barebone.Tools 7 | { 8 | public static class HtmlHelperExtension 9 | { 10 | public static bool IsDebug(this IHtmlHelper htmlHelper) 11 | { 12 | #if DEBUG 13 | return true; 14 | #else 15 | return false; 16 | #endif 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewComponents/MenuViewComponent.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Diagnostics; 5 | using System.Threading.Tasks; 6 | using ExtCore.Data.Abstractions; 7 | using Microsoft.AspNetCore.Mvc; 8 | using Microsoft.Extensions.Logging; 9 | using SoftinuxBase.Barebone.ViewModels.Shared.Menu; 10 | 11 | namespace SoftinuxBase.Barebone.ViewComponents 12 | { 13 | public class MenuViewComponent : ViewComponentBase 14 | { 15 | private readonly ILogger _logger; 16 | 17 | public MenuViewComponent(IStorage storage_, ILoggerFactory loggerFactory_) : base(storage_, loggerFactory_) 18 | { 19 | _logger = LoggerFactory.CreateLogger(GetType().FullName); 20 | } 21 | 22 | /// 23 | /// Asynchronously builds menu. 24 | /// 25 | /// IViewComponentResult object. 26 | public Task InvokeAsync() 27 | { 28 | MenuViewModelFactory factory = new MenuViewModelFactory(Storage, LoggerFactory); 29 | 30 | #if DEBUG 31 | Stopwatch watch = new Stopwatch(); 32 | watch.Start(); 33 | #endif 34 | MenuViewModel menu = factory.Create(); 35 | #if DEBUG 36 | watch.Stop(); 37 | _logger.LogInformation("Time to build menu content by MenuViewModelFactory: " + watch.ElapsedMilliseconds + " ms"); 38 | #endif 39 | return Task.FromResult(View(menu)); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewComponents/ScriptsViewComponent.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Diagnostics; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.Extensions.Logging; 8 | using SoftinuxBase.Barebone.ViewModels.Shared.Scripts; 9 | 10 | namespace SoftinuxBase.Barebone.ViewComponents 11 | { 12 | public class ScriptsViewComponent : ViewComponentBase 13 | { 14 | private readonly ILogger _logger; 15 | 16 | public ScriptsViewComponent(ILoggerFactory loggerFactory_) : base(loggerFactory_) 17 | { 18 | _logger = LoggerFactory.CreateLogger(GetType().FullName); 19 | } 20 | 21 | public Task InvokeAsync() 22 | { 23 | #if DEBUG 24 | Stopwatch watch = new Stopwatch(); 25 | watch.Start(); 26 | #endif 27 | ScriptsViewModel model = new ScriptsViewModelFactory().Create(); 28 | #if DEBUG 29 | watch.Stop(); 30 | _logger.LogInformation("Time to build scripts list by ScriptsViewModelFactory: " + watch.ElapsedMilliseconds + " ms"); 31 | #endif 32 | return Task.FromResult(View(model)); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewComponents/StyleSheetsViewComponent.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Diagnostics; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.Extensions.Logging; 8 | using SoftinuxBase.Barebone.ViewModels.Shared.StyleSheets; 9 | 10 | namespace SoftinuxBase.Barebone.ViewComponents 11 | { 12 | public class StyleSheetsViewComponent : ViewComponentBase 13 | { 14 | private readonly ILogger _logger; 15 | 16 | public StyleSheetsViewComponent(ILoggerFactory loggerFactory_) : base(loggerFactory_) 17 | { 18 | _logger = LoggerFactory.CreateLogger(GetType().FullName); 19 | } 20 | 21 | public Task InvokeAsync() 22 | { 23 | #if DEBUG 24 | Stopwatch watch = new Stopwatch(); 25 | watch.Start(); 26 | #endif 27 | StyleSheetsViewModel model = new StyleSheetsViewModelFactory().Create(); 28 | #if DEBUG 29 | watch.Stop(); 30 | _logger.LogInformation("Time to build stylesheets list by StyleSheetsViewModelFactory: " + watch.ElapsedMilliseconds + " ms"); 31 | #endif 32 | return Task.FromResult(View(model)); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewComponents/ViewComponentBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using ExtCore.Data.Abstractions; 5 | using Microsoft.AspNetCore.Mvc; 6 | using Microsoft.Extensions.Logging; 7 | 8 | namespace SoftinuxBase.Barebone.ViewComponents 9 | { 10 | public abstract class ViewComponentBase : ViewComponent 11 | { 12 | #pragma warning disable SA1401 // FieldsMustBePrivate 13 | 14 | /// 15 | /// Storage interface provided by services container. 16 | /// 17 | protected readonly IStorage Storage; 18 | 19 | /// 20 | /// Logger factory interface provided by services container. 21 | /// 22 | protected readonly ILoggerFactory LoggerFactory; 23 | 24 | #pragma warning restore SA1401 // FieldsMustBePrivate 25 | 26 | protected ViewComponentBase(IStorage storage_, ILoggerFactory loggerFactory_) 27 | { 28 | Storage = storage_; 29 | LoggerFactory = loggerFactory_; 30 | } 31 | 32 | protected ViewComponentBase(IStorage storage_) 33 | { 34 | Storage = storage_; 35 | } 36 | 37 | protected ViewComponentBase(ILoggerFactory loggerFactory_) 38 | { 39 | LoggerFactory = loggerFactory_; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Barebone/IndexViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Barebone.ViewModels.Barebone 5 | { 6 | public class IndexViewModel 7 | { 8 | public string ErrorMessage { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Barebone/IndexViewModelFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Barebone.ViewModels.Barebone 5 | { 6 | public class IndexViewModelFactory 7 | { 8 | public IndexViewModel Create() 9 | { 10 | return new IndexViewModel(); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Barebone.ViewModels 5 | { 6 | public class ErrorViewModel 7 | { 8 | public string RequestId { get; set; } 9 | 10 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 11 | } 12 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/Menu/MenuViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using SoftinuxBase.Barebone.ViewModels.Shared.MenuGroup; 6 | 7 | namespace SoftinuxBase.Barebone.ViewModels.Shared.Menu 8 | { 9 | public class MenuViewModel 10 | { 11 | public IEnumerable MenuGroups { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/MenuGroup/MenuGroupViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using SoftinuxBase.Barebone.ViewModels.Shared.MenuItem; 6 | 7 | namespace SoftinuxBase.Barebone.ViewModels.Shared.MenuGroup 8 | { 9 | public class MenuGroupViewModel 10 | { 11 | public string Name { get; set; } 12 | public uint Position { get; set; } 13 | public string FontAwesomeIconType { get; set; } 14 | public string FontAwesomeIconClass { get; set; } 15 | public List MenuItems { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/MenuGroup/MenuGroupViewModelFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using ExtCore.Data.Abstractions; 6 | using Microsoft.Extensions.Logging; 7 | using SoftinuxBase.Barebone.ViewModels.Shared.MenuItem; 8 | 9 | namespace SoftinuxBase.Barebone.ViewModels.Shared.MenuGroup 10 | { 11 | public class MenuGroupViewModelFactory : ViewModelFactoryBase 12 | { 13 | public MenuGroupViewModelFactory(IStorage storage_, ILoggerFactory loggerFactory_) 14 | : base(storage_, loggerFactory_) 15 | { 16 | } 17 | 18 | public MenuGroupViewModel Create(Infrastructure.MenuGroup menuGroup_) 19 | { 20 | return new MenuGroupViewModel() 21 | { 22 | Name = menuGroup_.Name, 23 | Position = menuGroup_.Position, 24 | FontAwesomeIconType = menuGroup_.FontAwesomeIconType.ToString(), 25 | FontAwesomeIconClass = menuGroup_.FontAwesomeIconClass, 26 | MenuItems = new List() 27 | }; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/MenuItem/MenuItemViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Barebone.ViewModels.Shared.MenuItem 5 | { 6 | public class MenuItemViewModel 7 | { 8 | public string Url { get; set; } 9 | public string Name { get; set; } 10 | public uint Position { get; set; } 11 | public string FontAwesoneIconType { get; set; } 12 | public string FontAwesomeIconClass { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/MenuItem/MenuitemViewModelFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using ExtCore.Data.Abstractions; 5 | using Microsoft.Extensions.Logging; 6 | 7 | namespace SoftinuxBase.Barebone.ViewModels.Shared.MenuItem 8 | { 9 | public class MenuItemViewModelFactory : ViewModelFactoryBase 10 | { 11 | public MenuItemViewModelFactory(IStorage storage_, ILoggerFactory loggerFactory_) 12 | : base(storage_, loggerFactory_) 13 | { 14 | } 15 | 16 | public MenuItemViewModel Create(Infrastructure.MenuItem menuItem_) 17 | { 18 | return new MenuItemViewModel() 19 | { 20 | Url = menuItem_.Url, 21 | Name = menuItem_.Name, 22 | Position = menuItem_.Position, 23 | FontAwesoneIconType = menuItem_.FontAwesomeIconType.ToString(), 24 | FontAwesomeIconClass = menuItem_.FontAwesomeIconClass 25 | }; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/Script/ScriptViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Barebone.ViewModels.Shared.Script 5 | { 6 | public class ScriptViewModel 7 | { 8 | public string Url { get; set; } 9 | 10 | public SoftinuxBase.Infrastructure.Script.JsType JsType { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/Script/ScriptViewModelFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Barebone.ViewModels.Shared.Script 5 | { 6 | public class ScriptViewModelFactory 7 | { 8 | public ScriptViewModel Create(Infrastructure.Script script_) 9 | { 10 | return new ScriptViewModel() 11 | { 12 | Url = script_.Url, 13 | JsType = script_.JsIsModule 14 | }; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/Scripts/ScriptsViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using SoftinuxBase.Barebone.ViewModels.Shared.Script; 6 | 7 | namespace SoftinuxBase.Barebone.ViewModels.Shared.Scripts 8 | { 9 | public class ScriptsViewModel 10 | { 11 | public IEnumerable Scripts { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/Scripts/ScriptsViewModelFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using ExtCore.Infrastructure; 7 | using SoftinuxBase.Barebone.ViewModels.Shared.Script; 8 | using SoftinuxBase.Infrastructure.Interfaces; 9 | 10 | namespace SoftinuxBase.Barebone.ViewModels.Shared.Scripts 11 | { 12 | public class ScriptsViewModelFactory 13 | { 14 | public ScriptsViewModel Create() 15 | { 16 | List scripts = new List(); 17 | 18 | foreach (IExtensionMetadata extensionMetadata in ExtensionManager.GetInstances()) 19 | { 20 | if (extensionMetadata.Scripts != null) 21 | { 22 | scripts.AddRange(extensionMetadata.Scripts); 23 | } 24 | } 25 | 26 | return new ScriptsViewModel() 27 | { 28 | Scripts = scripts.OrderBy(s_ => s_.Position).Select(s_ => new ScriptViewModelFactory().Create(s_)) 29 | }; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/StyleSheet/StyleSheetViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Barebone.ViewModels.Shared.StyleSheet 5 | { 6 | public class StyleSheetViewModel 7 | { 8 | public string Url { get; set; } 9 | public int Position { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/StyleSheet/StyleSheetViewModelFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Barebone.ViewModels.Shared.StyleSheet 5 | { 6 | public class StyleSheetViewModelFactory 7 | { 8 | public StyleSheetViewModel Create(Infrastructure.StyleSheet styleSheet_) 9 | { 10 | return new StyleSheetViewModel() 11 | { 12 | Url = styleSheet_.Url 13 | }; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/StyleSheets/StyleSheetsViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using SoftinuxBase.Barebone.ViewModels.Shared.StyleSheet; 6 | 7 | namespace SoftinuxBase.Barebone.ViewModels.Shared.StyleSheets 8 | { 9 | public class StyleSheetsViewModel 10 | { 11 | public IEnumerable StyleSheets { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/Shared/StyleSheets/StyleSheetsViewModelFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using ExtCore.Infrastructure; 7 | using SoftinuxBase.Barebone.ViewModels.Shared.StyleSheet; 8 | using SoftinuxBase.Infrastructure.Interfaces; 9 | 10 | namespace SoftinuxBase.Barebone.ViewModels.Shared.StyleSheets 11 | { 12 | public class StyleSheetsViewModelFactory 13 | { 14 | public StyleSheetsViewModel Create() 15 | { 16 | List styleSheets = new List(); 17 | 18 | foreach (IExtensionMetadata extensionMetadata in ExtensionManager.GetInstances()) 19 | { 20 | if (extensionMetadata.StyleSheets != null) 21 | { 22 | styleSheets.AddRange(extensionMetadata.StyleSheets); 23 | } 24 | } 25 | 26 | return new StyleSheetsViewModel() 27 | { 28 | StyleSheets = styleSheets.OrderBy(s_ => s_.Position).Select(s_ => new StyleSheetViewModelFactory().Create(s_)) 29 | }; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/ViewModels/ViewModelFactoryBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using ExtCore.Data.Abstractions; 5 | using Microsoft.Extensions.Logging; 6 | 7 | namespace SoftinuxBase.Barebone.ViewModels 8 | { 9 | public class ViewModelFactoryBase 10 | { 11 | #pragma warning disable SA1401 // FieldsMustBePrivate 12 | 13 | /// 14 | /// Storage interface provided by services container. 15 | /// 16 | protected readonly IStorage Storage; 17 | 18 | /// 19 | /// Logger factory interface provided by services container. 20 | /// 21 | protected readonly ILoggerFactory LoggerFactory; 22 | 23 | #pragma warning restore SA1401 // FieldsMustBePrivate 24 | 25 | /// 26 | /// Initializes a new instance of the class. 27 | /// 28 | /// The data storage instance. 29 | /// Optional. 30 | public ViewModelFactoryBase(IStorage storage_, ILoggerFactory loggerFactory_ = null) 31 | { 32 | Storage = storage_; 33 | LoggerFactory = loggerFactory_; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/About/Index.cshtml: -------------------------------------------------------------------------------- 1 | @* Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. *@ 3 | 4 | @section title { 5 | About 6 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Barebone/Index.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @model SoftinuxBase.Barebone.ViewModels.Barebone.IndexViewModel 7 | @section title { 8 | Dashboard 9 | } 10 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/Components/Menu/Default.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @model SoftinuxBase.Barebone.ViewModels.Shared.Menu.MenuViewModel 7 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/Components/Scripts/Default.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @model SoftinuxBase.Barebone.ViewModels.Shared.Scripts.ScriptsViewModel 7 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/Components/StyleSheets/Default.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @model SoftinuxBase.Barebone.ViewModels.Shared.StyleSheets.StyleSheetsViewModel 7 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model SoftinuxBase.Barebone.ViewModels.ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |

Error.

7 |

An error occurred while processing your request.

8 | 9 | @if (Model.ShowRequestId) 10 | { 11 |

12 | Request ID: @Model.RequestId 13 |

14 | } 15 | 16 |

Development Mode

17 |

18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

20 |

21 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. 22 |

-------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_CodeEditor.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 |

Code Editor

7 |
8 |
9 |
10 | 11 | select editor theme : 12 | 23 |
24 |
25 |
26 |
27 |
 
28 |
29 |
30 |
31 |
32 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_Footer.cshtml: -------------------------------------------------------------------------------- 1 | @* Main Footer *@ 2 |
3 | @* To the right *@ 4 | 7 | @* Default to the left *@ 8 | Copyright © 2017 SOFTINUX. All rights reserved. 9 |
-------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_IsDebugBanner.cshtml: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_Menu.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @model SoftinuxBase.Barebone.ViewModels.Shared.Menu.MenuViewModel 7 | @foreach (var menuGroup in Model.MenuGroups) 8 | { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_MenuGroup.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @model SoftinuxBase.Barebone.ViewModels.Shared.MenuGroup.MenuGroupViewModel 7 | 8 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_MenuItem.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @model SoftinuxBase.Barebone.ViewModels.Shared.MenuItem.MenuItemViewModel 7 | 12 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_Script.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @using SoftinuxBase.Infrastructure 7 | @model SoftinuxBase.Barebone.ViewModels.Shared.Script.ScriptViewModel 8 | @* including script with type "module" allows it to import ES6 modules *@ 9 | @{ 10 | switch (Model.JsType) 11 | { 12 | case Script.JsType.IsModule: 13 | 14 | break; 15 | case Script.JsType.NoModule: 16 | 17 | break; 18 | default: 19 | 20 | break; 21 | } 22 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_Scripts.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @model SoftinuxBase.Barebone.ViewModels.Shared.Scripts.ScriptsViewModel 7 | @foreach (var script in Model.Scripts) 8 | { 9 | 10 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_Sidebar.cshtml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_StyleSheet.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @model SoftinuxBase.Barebone.ViewModels.Shared.StyleSheet.StyleSheetViewModel 7 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/Shared/_StyleSheets.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @model SoftinuxBase.Barebone.ViewModels.Shared.StyleSheets.StyleSheetsViewModel 7 | @foreach (var styleSheet in Model.StyleSheets) 8 | { 9 | 10 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 7 | @using Microsoft.AspNetCore.Mvc.Rendering 8 | @using System.Linq -------------------------------------------------------------------------------- /src/SoftinuxBase.Barebone/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @{ 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Bundles/SoftinuxBase.Bundles.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | 11 6 | 0.0.1 7 | Benjamin Nolmans, Barbara Post 8 | SOFTINUX 9 | Copyright © 2021 Softinux 10 | SoftinuxBase.Bundles 11 | SoftinuxBase.Bundles 12 | SoftinuxBase.Bundles 13 | 14 | 15 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), SoftinuxBase.sln))\ 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Data.Sqlite/SoftinuxBase.Data.Sqlite.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Benjamin Nolmans, Barbara Post 5 | SOFTINUX 6 | Copyright © 2017 Softinux 7 | 0.0.1 8 | net7.0 9 | SoftinuxBase.Barebone 10 | SoftinuxBase.Barebone 11 | SoftinuxBase.Barebone 12 | 13 | http://www.softinux.com/ 14 | 15 | 16 | 17 | 11 18 | ..\..\StyleCopRules.ruleset 19 | https://github.com/SOFTINUX/Base 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | all 31 | runtime; build; native; contentfiles; analyzers 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Infrastructure/CorporateConfiguration.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Infrastructure 5 | { 6 | public class CorporateConfiguration 7 | { 8 | /// 9 | /// Gets or sets corporation name. 10 | /// 11 | public string Name { get; set; } 12 | 13 | /// 14 | /// Gets or sets corporation logo. 15 | /// 16 | public string BrandLogo { get; set; } 17 | 18 | /// 19 | /// Gets or sets login background picture. 20 | /// 21 | public string LoginBackgroundImage { get; set; } 22 | 23 | /// 24 | /// Gets or sets a value indicating whether user can self register. 25 | /// 26 | public bool RegisterNewUsers { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Infrastructure/FontAwesomeIcon.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Infrastructure 5 | { 6 | public static class FontAwesomeIcon 7 | { 8 | /// 9 | /// Type for font awesome icon. 10 | /// 11 | [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "")] 12 | public enum IconType 13 | { 14 | Fas = 0, 15 | Far = 1, 16 | Fal = 2, 17 | Fad = 3 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Infrastructure/HtmlExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Infrastructure 5 | { 6 | public static class HtmlExtensions 7 | { 8 | /* public static HtmlString FALink(this IHtmlHelper htmlHelper, string action, string controller, string link_text, string fa_class, string btn_css_classes = "", string button_id = "", object route_values = null) 9 | { 10 | //Declare the span 11 | TagBuilder span = new TagBuilder("span"); 12 | span.AddCssClass($"fa fa-{fa_class}"); 13 | span.MergeAttribute("aria-hidden", "true"); 14 | 15 | //Declare the anchor tag 16 | TagBuilder anchor = new TagBuilder("a"); 17 | //add the href attribute to the element 18 | if (string.IsNullOrEmpty(controller) || string.IsNullOrEmpty(action)) 19 | anchor.MergeAttribute("href", "#"); 20 | else 21 | anchor.MergeAttribute("href", new UrlHelper(UrlActionContext).Action(action, controller, route_values)); 22 | 23 | //Add the element and the text to the element 24 | anchor.InnerHtml.AppendHtml($"{span} {link_text}"); 25 | anchor.AddCssClass(btn_css_classes); 26 | anchor.GenerateId(button_id, ""); 27 | 28 | //Create the helper 29 | return HtmlString.Create(anchor.ToString(TagRenderMode.Normal)); 30 | } */ 31 | } 32 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Infrastructure/Script.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Infrastructure 5 | { 6 | public class Script 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// set url to load script. 12 | /// set position of script in the list of scripts included in the page. 13 | /// set if script is a js module. 14 | public Script(string url_, int position_, JsType jsType_ = JsType.JsNormal) 15 | { 16 | Url = url_; 17 | Position = position_; 18 | JsIsModule = jsType_; 19 | } 20 | 21 | /// 22 | /// Enum for js script type. 23 | /// 24 | public enum JsType 25 | { 26 | /// 27 | /// Is module javascript file 28 | /// 29 | IsModule = 0, 30 | 31 | /// 32 | /// Is nomodule javascript file 33 | /// 34 | NoModule = 1, 35 | 36 | /// 37 | /// Is normal javascript file 38 | /// 39 | JsNormal = 2 40 | } 41 | 42 | /// 43 | /// Gets url of script included in the page. 44 | /// 45 | public string Url { get; private set; } 46 | 47 | /// 48 | /// Gets a value indicating whether get if script is imported as module. 49 | /// 50 | public JsType JsIsModule { get; private set; } 51 | 52 | /// 53 | /// Gets position of the script in the list of scripts included in the page. 54 | /// 55 | public int Position { get; } 56 | } 57 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Infrastructure/SoftinuxBase.Infrastructure.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Benjamin Nolmans, Barbara Post 4 | SOFTINUX 5 | Copyright © 2017 Softinux 6 | 0.0.1 7 | net7.0 8 | SoftinuxBase.Infrastructure 9 | SoftinuxBase.Infrastructure 10 | SoftinuxBase.Infrastructure 11 | 12 | http://www.softinux.com/ 13 | 11 14 | ..\..\StyleCopRules.ruleset 15 | https://github.com/SOFTINUX/Base 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | all 31 | runtime; build; native; contentfiles; analyzers 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Infrastructure/StyleSheet.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Infrastructure 5 | { 6 | public class StyleSheet 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// set url to load css. 12 | /// set position of css in the list of css included in the page. 13 | public StyleSheet(string url_, int position_) 14 | { 15 | Url = url_; 16 | Position = position_; 17 | } 18 | 19 | /// 20 | /// Gets url of css included in the page. 21 | /// 22 | public string Url { get; private set; } 23 | 24 | /// 25 | /// Gets position of the css in the list of css included in the page. 26 | /// 27 | public int Position { get; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Infrastructure/Tools/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Infrastructure.Tools 5 | { 6 | public static class StringExtensions 7 | { 8 | /// 9 | /// Extend String class to 10 | /// transform first letter of string in upper case. 11 | /// 12 | /// string to make first letter in upper case. 13 | /// return the string with first letter in upper case. 14 | public static string UppercaseFirst(this string s_) 15 | { 16 | if (string.IsNullOrEmpty(s_)) 17 | { 18 | return string.Empty; 19 | } 20 | 21 | string s = s_.ToLowerInvariant(); 22 | char[] a = s.ToCharArray(); 23 | a[0] = char.ToUpper(a[0]); 24 | return new string(a); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.AuthorizeSetup/AddPermissionsDataKeyToUserClaims.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System.Security.Claims; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Identity; 7 | using Microsoft.Extensions.Options; 8 | using SoftinuxBase.Security.Data.Entities; 9 | using SoftinuxBase.Security.Data.EntityFramework; 10 | using SoftinuxBase.Security.FeatureAuthorize; 11 | 12 | namespace SoftinuxBase.Security.AuthorizeSetup 13 | { 14 | /// 15 | /// This version provides: 16 | /// - Adds Permissions to the user's claims. 17 | /// - Adds DataKey to the user's claims 18 | /// 19 | // Thanks to https://korzh.com/blogs/net-tricks/aspnet-identity-store-user-data-in-claims 20 | public class AddPermissionsDataKeyToUserClaims : UserClaimsPrincipalFactory 21 | { 22 | private readonly ApplicationStorageContext _extraAuthDbContext; 23 | 24 | public AddPermissionsDataKeyToUserClaims(UserManager userManager_, IOptions optionsAccessor_, 25 | ApplicationStorageContext extraAuthDbContext_) 26 | : base(userManager_, optionsAccessor_) 27 | { 28 | _extraAuthDbContext = extraAuthDbContext_; 29 | } 30 | 31 | protected override async Task GenerateClaimsAsync(User user_) 32 | { 33 | var identity = await base.GenerateClaimsAsync(user_); 34 | var userId = identity.Claims.GetUserIdFromClaims(); 35 | var rtoPCalcer = new CalcAllowedPermissions(_extraAuthDbContext); 36 | identity.AddClaim(new Claim(PermissionConstants.PackedPermissionClaimType, await rtoPCalcer.CalcPermissionsForUserAsync(userId))); 37 | return identity; 38 | } 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.AuthorizeSetup/AddPermissionsToUserClaims.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System.Security.Claims; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Identity; 7 | using Microsoft.Extensions.Options; 8 | using SoftinuxBase.Security.Data.Entities; 9 | using SoftinuxBase.Security.Data.EntityFramework; 10 | using SoftinuxBase.Security.FeatureAuthorize; 11 | 12 | namespace SoftinuxBase.Security.AuthorizeSetup 13 | { 14 | /// 15 | /// This version provides: 16 | /// - Adds Permissions to the user's claims. 17 | /// 18 | // Thanks to https://korzh.com/blogs/net-tricks/aspnet-identity-store-user-data-in-claims 19 | public class AddPermissionsToUserClaims : UserClaimsPrincipalFactory 20 | { 21 | private readonly ApplicationStorageContext _extraAuthDbContext; 22 | 23 | public AddPermissionsToUserClaims(UserManager userManager_, IOptions optionsAccessor_, 24 | ApplicationStorageContext extraAuthDbContext_) 25 | : base(userManager_, optionsAccessor_) 26 | { 27 | _extraAuthDbContext = extraAuthDbContext_; 28 | } 29 | 30 | protected override async Task GenerateClaimsAsync(User user_) 31 | { 32 | var identity = await base.GenerateClaimsAsync(user_); 33 | var userId = identity.Claims.GetUserIdFromClaims(); 34 | var rtoPCalcer = new CalcAllowedPermissions(_extraAuthDbContext); 35 | identity.AddClaim(new Claim(PermissionConstants.PackedPermissionClaimType, await rtoPCalcer.CalcPermissionsForUserAsync(userId))); 36 | return identity; 37 | } 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.AuthorizeSetup/IAuthCookieValidate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Authentication.Cookies; 6 | 7 | namespace SoftinuxBase.Security.AuthorizeSetup 8 | { 9 | public interface IAuthCookieValidate 10 | { 11 | Task ValidateAsync(CookieValidatePrincipalContext context_); 12 | } 13 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.AuthorizeSetup/PermissionsSetupOptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | namespace SoftinuxBase.Security.AuthorizeSetup 5 | { 6 | public enum AuthCookieVersions 7 | { 8 | Off, 9 | //These use UserClaimsPrincipalFactory on login 10 | LoginPermissions, LoginPermissionsDataKey, 11 | //These use The Cookie OnValidatePrincipal event 12 | PermissionsOnly, PermissionsDataKey, Impersonation, RefreshClaims, Everything 13 | } 14 | 15 | public class PermissionsSetupOptions 16 | { 17 | public string DatabaseSetup { get; set; } 18 | public bool CreateAndSeed { get; set; } 19 | public AuthCookieVersions AuthVersion { get; set; } 20 | } 21 | 22 | 23 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.AuthorizeSetup/SoftinuxBase.Security.AuthorizeSetup.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Abstractions/IAspNetUsersRepository.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using ExtCore.Data.Abstractions; 6 | using Microsoft.AspNetCore.Identity; 7 | using SoftinuxBase.Security.Data.Entities; 8 | 9 | // [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("SoftinuxBase.Security")] 10 | // [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("SoftinuxBase.Security.Data.EntityFramework")] 11 | namespace SoftinuxBase.Security.Data.Abstractions 12 | { 13 | /// 14 | /// An interface for performing queries related to . 15 | /// 16 | public interface IAspNetUsersRepository : IRepository 17 | { 18 | /// 19 | /// Check by name or e-mail user existence. 20 | /// 21 | /// String value from or . 22 | /// A bool indicating that an user was found. 23 | bool FindByNormalizedUserNameOrEmail(string normalizedValue_); 24 | 25 | /// 26 | /// Find all the users linked to roles. 27 | /// 28 | /// role names. 29 | /// users. 30 | IEnumerable FindUsersHavingRoles(IEnumerable roleNames_); 31 | } 32 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Abstractions/IUserToRoleRepository.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using ExtCore.Data.Abstractions; 6 | using SoftinuxBase.Security.Data.Entities; 7 | 8 | namespace SoftinuxBase.Security.Data.Abstractions 9 | { 10 | public interface IUserToRoleRepository : IRepository 11 | { 12 | /// 13 | /// Gets all the records. 14 | /// 15 | /// All records. 16 | IEnumerable All(); 17 | 18 | /// 19 | /// Delete all user to roles records. 20 | /// 21 | void DeleteAll(); 22 | 23 | /// 24 | /// Link an user to a role. Does nothing if the link already exists. 25 | /// 26 | /// User Id. 27 | /// Role name. 28 | /// True when a record was created. 29 | bool AddUserToRole(string userId_, string roleName_); 30 | 31 | /// 32 | /// Find a record. 33 | /// 34 | /// User Id. 35 | /// Role name. 36 | /// True when a record was found for this user and this role. 37 | UserToRole Find(string userId_, string roleName_); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Abstractions/SoftinuxBase.Security.Data.Abstractions.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Benjamin Nolmans, Barbara Post 4 | SOFTINUX 5 | Copyright © 2017 Softinux 6 | 0.0.1 7 | net7.0 8 | SoftinuxBase.Security.Data.Abstractions 9 | SoftinuxBase.Security.Data.Abstractions 10 | SoftinuxBase.Security.Data.Abstractions 11 | 12 | http://www.softinux.com/ 13 | 14 | 15 | 11 16 | ..\..\StyleCopRules.ruleset 17 | https://github.com/SOFTINUX/Base 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | all 29 | runtime; build; native; contentfiles; analyzers 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Entities/ExtraAuthConstants.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable SA1636 2 | 3 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 4 | // Licensed under MIT license. See License.txt in the project root for license information. 5 | #pragma warning restore SA1636 6 | namespace SoftinuxBase.Security.Data.Entities 7 | { 8 | public static class ExtraAuthConstants 9 | { 10 | public const int UserIdSize = 36; // This is the size of a GUID when returned as a string 11 | 12 | public const int RoleNameSize = 100; 13 | } 14 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Entities/IAddRemoveEffectsUser.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable SA1636 2 | /* Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 3 | Licensed under MIT license. See License.txt in the project root for license information. */ 4 | 5 | namespace SoftinuxBase.Security.Data.Entities 6 | { 7 | public interface IAddRemoveEffectsUser 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Entities/IChangeEffectsUser.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable SA1636 2 | /* Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 3 | Licensed under MIT license. See License.txt in the project root for license information. */ 4 | 5 | namespace SoftinuxBase.Security.Data.Entities 6 | { 7 | public interface IChangeEffectsUser 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Entities/ModulesForUser.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable SA1636 2 | /* Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 3 | Licensed under MIT license. See License.txt in the project root for license information. */ 4 | 5 | using System; 6 | using System.ComponentModel.DataAnnotations; 7 | using SoftinuxBase.Security.Permissions; 8 | 9 | namespace SoftinuxBase.Security.Data.Entities 10 | { 11 | /// 12 | /// This holds what modules a user or tenant has. 13 | /// 14 | public class ModulesForUser : IChangeEffectsUser, IAddRemoveEffectsUser 15 | { 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// This links modules to a user. 19 | /// 20 | /// 21 | /// 22 | public ModulesForUser(string userId_, PaidForModules allowedPaidForModules_) 23 | { 24 | UserId = userId_ ?? throw new ArgumentNullException(nameof(userId_)); 25 | AllowedPaidForModules = allowedPaidForModules_; 26 | } 27 | 28 | [Key] 29 | [MaxLength(ExtraAuthConstants.UserIdSize)] 30 | public string UserId { get; private set; } 31 | 32 | public PaidForModules AllowedPaidForModules { get; private set; } 33 | 34 | /// 35 | /// Initializes a new instance of the class. 36 | /// Empty constructor for migration to work. 37 | /// 38 | #pragma warning disable SA1201 39 | 40 | // ReSharper disable once UnusedMember.Local 41 | private ModulesForUser() 42 | { 43 | } 44 | #pragma warning restore SA1201 45 | } 46 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Entities/NoQueryFilterNeeded.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable SA1636 2 | /* Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 3 | Licensed under MIT license. See License.txt in the project root for license information. */ 4 | 5 | using System; 6 | 7 | namespace SoftinuxBase.Security.Data.Entities 8 | { 9 | /// 10 | /// This is used to mark a database class that doesn't need a query filter. 11 | /// This is only there so that you can unit test that all filters are set up for the classes that do have an access key. 12 | /// 13 | public class NoQueryFilterNeeded : Attribute 14 | { 15 | } 16 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Entities/SoftinuxBase.Security.Data.Entities.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Benjamin Nolmans, Barbara Post 4 | SOFTINUX 5 | Copyright © 2017 Softinux 6 | 0.0.1 7 | net7.0 8 | SoftinuxBase.Security.Data.Entities 9 | SoftinuxBase.Security.Data.Entities 10 | SoftinuxBase.Security.Data.Entities 11 | 12 | http://www.softinux.com/ 13 | 14 | 15 | 11 16 | ..\..\StyleCopRules.ruleset 17 | https://github.com/SOFTINUX/Base 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | all 30 | runtime; build; native; contentfiles; analyzers 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Entities/TimeStore.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.ComponentModel.DataAnnotations; 5 | using SoftinuxBase.Security.RefreshClaims; 6 | 7 | namespace SoftinuxBase.Security.Data.Entities 8 | { 9 | [NoQueryFilterNeeded] 10 | public class TimeStore 11 | { 12 | [Key] 13 | [Required] 14 | [MaxLength(AuthChangesConsts.CacheKeyMaxSize)] 15 | public string Key { get; set; } 16 | 17 | public long LastUpdatedTicks { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.Entities/User.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using ExtCore.Data.Entities.Abstractions; 6 | using Microsoft.AspNetCore.Identity; 7 | 8 | namespace SoftinuxBase.Security.Data.Entities 9 | { 10 | public class User : IdentityUser, IEntity 11 | { 12 | public string FirstName { get; set; } 13 | public string LastName { get; set; } 14 | public DateTime FirstConnection { get; set; } 15 | public DateTime LastConnection { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.EntityFramework.Mssql/SoftinuxBase.Security.Data.EntityFramework.Mssql.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Benjamin Nolmans, Barbara Post 5 | SOFTINUX 6 | Copyright © 2017 Softinux 7 | 0.0.1 8 | net7.0 9 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 10 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 11 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 12 | 13 | http://www.softinux.com/ 14 | 15 | 16 | 17 | 11 18 | ..\..\StyleCopRules.ruleset 19 | https://github.com/SOFTINUX/Base 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | all 36 | runtime; build; native; contentfiles; analyzers 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.EntityFramework.Mysql/SoftinuxBase.Security.Data.EntityFramework.Mysql.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Benjamin Nolmans, Barbara Post 5 | SOFTINUX 6 | Copyright © 2017 Softinux 7 | 0.0.1 8 | net7.0 9 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 10 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 11 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 12 | 13 | http://www.softinux.com/ 14 | 15 | 16 | 17 | 11 18 | ..\..\StyleCopRules.ruleset 19 | https://github.com/SOFTINUX/Base 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | all 36 | runtime; build; native; contentfiles; analyzers 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.EntityFramework.Npgsql/SoftinuxBase.Security.Data.EntityFramework.Npgsql.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Benjamin Nolmans, Barbara Post 5 | SOFTINUX 6 | Copyright © 2017 Softinux 7 | 0.0.1 8 | net7.0 9 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 10 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 11 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 12 | 13 | http://www.softinux.com/ 14 | 15 | 16 | 17 | 11 18 | ..\..\StyleCopRules.ruleset 19 | https://github.com/SOFTINUX/Base 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | all 36 | runtime; build; native; contentfiles; analyzers 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.EntityFramework.Sqlite/SoftinuxBase.Security.Data.EntityFramework.Sqlite.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Benjamin Nolmans, Barbara Post 4 | SOFTINUX 5 | Copyright © 2017 Softinux 6 | 0.0.1 7 | net7.0 8 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 9 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 10 | SoftinuxBase.Security.Data.EntityFramework.Sqlite 11 | 12 | http://www.softinux.com/ 13 | 14 | 15 | 11 16 | ..\..\StyleCopRules.ruleset 17 | https://github.com/SOFTINUX/Base 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | all 29 | runtime; build; native; contentfiles; analyzers 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.EntityFramework/ChangeExtensions.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable SA1636 2 | /* Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 3 | Licensed under MIT license. See License.txt in the project root for license information. */ 4 | 5 | using System.Linq; 6 | using Microsoft.EntityFrameworkCore; 7 | using SoftinuxBase.Security.Data.Entities; 8 | 9 | namespace SoftinuxBase.Security.Data.EntityFramework 10 | { 11 | public static class ChangeExtensions 12 | { 13 | public static bool UserPermissionsMayHaveChanged(this DbContext context_) 14 | { 15 | return context_.ChangeTracker.Entries() 16 | .Any(x => (x.Entity is IChangeEffectsUser && x.State == EntityState.Modified) || 17 | (x.Entity is IAddRemoveEffectsUser && 18 | (x.State == EntityState.Added || x.State == EntityState.Deleted))); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.EntityFramework/ConfigExtensions.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable SA1636 2 | /* Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 3 | Licensed under MIT license. See License.txt in the project root for license information. */ 4 | 5 | using Microsoft.EntityFrameworkCore; 6 | using SoftinuxBase.Security.Data.Entities; 7 | 8 | namespace SoftinuxBase.Security.Data.EntityFramework 9 | { 10 | /// 11 | /// I need to place the configs for the databases in one place because I use context.Database.EnsureCreated to create it. 12 | /// This is only for a demo app - I would normally do this via SQL scripts and EFSchemaCompare 13 | /// https://www.thereformedprogrammer.net/handling-entity-framework-core-database-migrations-in-production-part-1/#2b-hand-coding-sql-migration-scripts. 14 | /// 15 | public static class ConfigExtensions 16 | { 17 | public static void TenantBaseConfig(this ModelBuilder modelBuilder_) 18 | { 19 | // This is needed in version 2.2 to make the _children collection work, but isn't needed in EF Core 3 20 | // see https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.0/breaking-changes#backing-fields-are-used-by-default 21 | modelBuilder_.UsePropertyAccessMode(PropertyAccessMode.Field); 22 | } 23 | 24 | public static void ExtraAuthorizeConfig(this ModelBuilder modelBuilder_) 25 | { 26 | modelBuilder_.Entity().HasKey(x => new { x.UserId, x.RoleName }); 27 | 28 | modelBuilder_.Entity() 29 | .Property("_permissionsInRole") 30 | .HasColumnName("PermissionsInRole"); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.EntityFramework/EfLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using System.IO; 6 | using System.Reflection; 7 | using Microsoft.Extensions.Logging; 8 | 9 | namespace SoftinuxBase.Security.Data.EntityFramework 10 | { 11 | public class EfLoggerProvider : ILoggerProvider 12 | { 13 | private static readonly object _logFileWriteLock = new object(); 14 | 15 | public static string LogFilePath => 16 | Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "entityframework.log"); 17 | 18 | public ILogger CreateLogger(string categoryName_) 19 | { 20 | return new EfLogger(); 21 | } 22 | 23 | public void Dispose() 24 | { 25 | } 26 | 27 | private class EfLogger : ILogger 28 | { 29 | public bool IsEnabled(LogLevel logLevel_) 30 | { 31 | return true; 32 | } 33 | 34 | public void Log(LogLevel logLevel_, EventId eventId_, TState state_, Exception exception_, Func formatter_) 35 | { 36 | lock (_logFileWriteLock) 37 | { 38 | File.AppendAllText(LogFilePath, formatter_(state_, exception_)); 39 | } 40 | } 41 | 42 | public IDisposable BeginScope(TState state_) 43 | { 44 | return null; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.EntityFramework/EntityRegistrar.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using ExtCore.Data.EntityFramework; 5 | using Microsoft.AspNetCore.Identity; 6 | using Microsoft.EntityFrameworkCore; 7 | 8 | namespace SoftinuxBase.Security.Data.EntityFramework 9 | { 10 | public class EntityRegistrar : IEntityRegistrar 11 | { 12 | public void RegisterEntities(ModelBuilder modelBuilder_) 13 | { 14 | // Class provided by Identity 15 | modelBuilder_.Entity() 16 | .Property(e_ => e_.Id) 17 | .ValueGeneratedOnAdd(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.EntityFramework/RoleToPermissionsRepository.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using ExtCore.Data.EntityFramework; 7 | using SoftinuxBase.Security.Data.Abstractions; 8 | using SoftinuxBase.Security.Data.Entities; 9 | using SoftinuxBase.Security.Permissions; 10 | 11 | namespace SoftinuxBase.Security.Data.EntityFramework 12 | { 13 | public class RoleToPermissionsRepository : RepositoryBase, IRoleToPermissionsRepository 14 | { 15 | /// 16 | public IEnumerable All() 17 | { 18 | return dbSet.ToList(); 19 | } 20 | 21 | /// 22 | public void DeleteAll() 23 | { 24 | dbSet.RemoveRange(dbSet.ToArray()); 25 | } 26 | 27 | /// 28 | public void Delete(RoleToPermissions entity_) 29 | { 30 | dbSet.Remove(entity_); 31 | } 32 | 33 | /// 34 | public RoleToPermissions FindBy(string roleName_) 35 | { 36 | return dbSet.FirstOrDefault(role_ => role_.RoleName == roleName_); 37 | } 38 | 39 | /// 40 | public void Create(RoleToPermissions entity_) 41 | { 42 | dbSet.Add(entity_); 43 | } 44 | 45 | /// 46 | public bool SetPermissions(string roleName_, PermissionsDictionary permissions_) 47 | { 48 | var roleToPermission = FindBy(roleName_); 49 | if (roleToPermission == null) 50 | { 51 | return false; 52 | } 53 | 54 | roleToPermission.Update(permissions_); 55 | return true; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Data.EntityFramework/SoftinuxBase.Security.Data.EntityFramework.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Benjamin Nolmans, Barbara Post 4 | SOFTINUX 5 | Copyright © 2017 Softinux 6 | 0.0.1 7 | net7.0 8 | SoftinuxBase.Security.Data.EntityFramework 9 | SoftinuxBase.Security.Data.EntityFramework 10 | SoftinuxBase.Security.Data.EntityFramework 11 | 12 | http://www.softinux.com/ 13 | 14 | 15 | 11 16 | ..\..\StyleCopRules.ruleset 17 | https://github.com/SOFTINUX/Base 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | all 30 | runtime; build; native; contentfiles; analyzers 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.FeatureAuthorize/ClaimsExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Security.Claims; 7 | 8 | namespace SoftinuxBase.Security.FeatureAuthorize 9 | { 10 | public static class ClaimsExtensions 11 | { 12 | public static string GetUserIdFromClaims(this IEnumerable claims_) 13 | { 14 | return claims_?.SingleOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.FeatureAuthorize/Extensions/UserExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using System.Linq; 6 | using System.Security.Claims; 7 | using SoftinuxBase.Security.Permissions; 8 | 9 | namespace SoftinuxBase.Security.FeatureAuthorize.Extensions 10 | { 11 | public static class UserExtensions 12 | { 13 | // TOTEST 14 | 15 | /// 16 | /// Checks whether an user has a specific permission. 17 | /// 18 | /// The Razor page user ("this.User"). 19 | /// Permission enum type, for example 20 | /// Permission enum value, for example a value in 21 | /// 22 | public static bool HasPermission(this ClaimsPrincipal user_, Type permissionEnumType_, short permission_) 23 | { 24 | var permissionsClaim = user_.Claims.SingleOrDefault(c => c.Type == PermissionConstants.PackedPermissionClaimType); 25 | // If user does not have the scope claim, get out of here 26 | if (permissionsClaim == null) 27 | return false; 28 | 29 | return (permissionsClaim.Value.ToPackedPermissions().ThisPermissionIsAllowed(StringExtensions.ToPolicyName(permissionEnumType_, permission_))); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.FeatureAuthorize/PermissionConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | namespace SoftinuxBase.Security.FeatureAuthorize 4 | { 5 | public static class PermissionConstants 6 | { 7 | public const string PackedPermissionClaimType = "Permissions"; 8 | public const string LastPermissionsUpdatedClaimType = "PermissionUpdated"; 9 | } 10 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.FeatureAuthorize/PolicyCode/AuthorizationPolicyProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.Extensions.Options; 7 | 8 | namespace SoftinuxBase.Security.FeatureAuthorize.PolicyCode 9 | { 10 | //thanks to https://www.jerriepelser.com/blog/creating-dynamic-authorization-policies-aspnet-core/ 11 | //And to GholamReza Rabbal see https://github.com/JonPSmith/PermissionAccessControl/issues/3 12 | 13 | public class AuthorizationPolicyProvider : DefaultAuthorizationPolicyProvider 14 | { 15 | private readonly AuthorizationOptions _options; 16 | 17 | public AuthorizationPolicyProvider(IOptions options) : base(options) 18 | { 19 | _options = options.Value; 20 | } 21 | 22 | public override async Task GetPolicyAsync(string policyName) 23 | { 24 | //Unit tested shows this is quicker (and safer - see link to issue above) than the original version 25 | return await base.GetPolicyAsync(policyName) 26 | ?? new AuthorizationPolicyBuilder() 27 | .AddRequirements(new PermissionRequirement(policyName)) 28 | .Build(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.FeatureAuthorize/PolicyCode/HasPermissionAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ and 2017-2019 SOFTINUX. 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.AspNetCore.Authorization; 6 | using SoftinuxBase.Security.Permissions; 7 | 8 | namespace SoftinuxBase.Security.FeatureAuthorize.PolicyCode 9 | { 10 | /// 11 | /// Use this attribute onto a controller's class or method to restrict access. 12 | /// 13 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)] 14 | public class HasPermissionAttribute : AuthorizeAttribute 15 | { 16 | /// 17 | /// Constructor. 18 | /// 19 | /// The enum type 20 | /// Any value of 21 | public HasPermissionAttribute(Type permissionEnumType_, short permission_) : base(StringExtensions.ToPolicyName(permissionEnumType_, permission_)) 22 | { 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.FeatureAuthorize/PolicyCode/PermissionHandler.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Authorization; 7 | using SoftinuxBase.Security.Permissions; 8 | 9 | namespace SoftinuxBase.Security.FeatureAuthorize.PolicyCode 10 | { 11 | //thanks to https://www.jerriepelser.com/blog/creating-dynamic-authorization-policies-aspnet-core/ 12 | 13 | public class PermissionHandler : AuthorizationHandler 14 | { 15 | protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, PermissionRequirement requirement) 16 | { 17 | var permissionsClaim = 18 | context.User.Claims.SingleOrDefault(c => c.Type == PermissionConstants.PackedPermissionClaimType); 19 | // If user does not have the scope claim, get out of here 20 | if (permissionsClaim == null) 21 | return Task.CompletedTask; 22 | 23 | if (permissionsClaim.Value.ToPackedPermissions().ThisPermissionIsAllowed(requirement.PermissionName)) 24 | context.Succeed(requirement); 25 | 26 | return Task.CompletedTask; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.FeatureAuthorize/PolicyCode/PermissionRequirement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.AspNetCore.Authorization; 6 | 7 | namespace SoftinuxBase.Security.FeatureAuthorize.PolicyCode 8 | { 9 | public class PermissionRequirement : IAuthorizationRequirement 10 | { 11 | public PermissionRequirement(string permissionName) 12 | { 13 | PermissionName = permissionName ?? throw new ArgumentNullException(nameof(permissionName)); 14 | } 15 | 16 | /// 17 | /// Gets the permission unique name (policy name). 18 | /// 19 | public string PermissionName { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.FeatureAuthorize/SoftinuxBase.Security.FeatureAuthorize.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Permissions/Attributes/PasswordAttributes.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Text.RegularExpressions; 7 | 8 | namespace SoftinuxBase.Security.Permissions.Attributes 9 | { 10 | // TODO use or remove 11 | public class PasswordAttributes 12 | { 13 | public static ValidationResult PasswordStrongTest(string value_, ValidationContext validationContext_) 14 | { 15 | if (value_ == null) 16 | { 17 | return ValidationResult.Success; 18 | } 19 | 20 | if (!Regex.IsMatch(value_, @"(?=^.{6,10}$)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{":;'?/>.<,])(?!.*\s).*$")) 21 | { 22 | return new ValidationResult("It expects at least 1 small-case letter, 1 capital letter,1 digit, 1 special character and the length should be between 6-10 characters. ", new List { "Password" }); 23 | } 24 | 25 | return ValidationResult.Success; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Permissions/Enums/ClaimType.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Security.Permissions.Enums 5 | { 6 | public class ClaimType 7 | { 8 | public const string Permission = "Permission"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Permissions/LinkedToModuleAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace SoftinuxBase.Security.Permissions 7 | { 8 | [AttributeUsage(AttributeTargets.Field)] 9 | public class LinkedToModuleAttribute : Attribute 10 | { 11 | public PaidForModules PaidForModule { get; private set; } 12 | 13 | public LinkedToModuleAttribute(PaidForModules paidForModule) 14 | { 15 | PaidForModule = paidForModule; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Permissions/PaidForModules.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace SoftinuxBase.Security.Permissions 7 | { 8 | /// 9 | /// This is an example of how you would manage what optional parts of your system a user can access 10 | /// NOTE: You can add Display attributes (as done on Permissions) to give more information about a module 11 | /// 12 | [Flags] 13 | public enum PaidForModules : long 14 | { 15 | None = 0, 16 | Feature1 = 1, 17 | Feature2 = 2, 18 | Feature3 = 4 19 | } 20 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Permissions/SoftinuxBase.Security.Permissions.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.Permissions/TypeExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace SoftinuxBase.Security.Permissions 7 | { 8 | public static class TypeExtensions 9 | { 10 | /// 11 | /// Verifies that matches . 12 | /// 13 | /// Enum type. 14 | /// Value to check. 15 | /// . 16 | /// . 17 | /// is not contained in enumeration of type 18 | public static void VerifyThatTypeContainsEnumValue(this Type type_, short enumValue_) 19 | { 20 | if (!Enum.IsDefined(type_, enumValue_)) 21 | { 22 | throw new NotSupportedException($"Value {enumValue_} is not defined in enum {type_.FullName}"); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.RefreshClaims/AuthChanges.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Runtime.CompilerServices; 6 | 7 | [assembly: InternalsVisibleTo("Test")] 8 | 9 | namespace SoftinuxBase.Security.RefreshClaims 10 | { 11 | public class AuthChanges : IAuthChanges 12 | { 13 | /// 14 | /// This returns true if ticksToCompareString is null, or if its value is lower than the value in the TimeStore 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | public bool IsOutOfDateOrMissing(string cacheKey, string ticksToCompareString, ITimeStore timeStore) 21 | { 22 | if (ticksToCompareString == null) 23 | //if there is no time claim then you do need to reset the claims 24 | return true; 25 | 26 | var ticksToCompare = long.Parse(ticksToCompareString); 27 | return IsOutOfDate(cacheKey, ticksToCompare, timeStore); 28 | } 29 | 30 | private bool IsOutOfDate(string cacheKey, long ticksToCompare, ITimeStore timeStore) 31 | { 32 | var cachedTicks = timeStore.GetValueFromStore(cacheKey); 33 | if (cachedTicks != null) 34 | { 35 | return ticksToCompare < cachedTicks; 36 | } 37 | 38 | // seed the database with a cache value for the key 39 | this.AddOrUpdate(timeStore); 40 | return true; 41 | 42 | } 43 | 44 | public void AddOrUpdate(ITimeStore timeStore) 45 | { 46 | timeStore.AddUpdateValue(AuthChangesConsts.FeatureCacheKey, DateTime.UtcNow.Ticks); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.RefreshClaims/AuthChangesConsts.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | namespace SoftinuxBase.Security.RefreshClaims 5 | { 6 | public static class AuthChangesConsts 7 | { 8 | public const int CacheKeyMaxSize = 36; 9 | 10 | public const string FeatureCacheKey = "8FA8E7A8-0ADD-433C-B063-3BD725254C9B"; 11 | } 12 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.RefreshClaims/IAuthChanges.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | namespace SoftinuxBase.Security.RefreshClaims 5 | { 6 | public interface IAuthChanges 7 | { 8 | /// 9 | /// This returns true if there is no ticksToCompare or the ticksToCompare is earlier than the AuthLastUpdated time 10 | /// 11 | /// 12 | /// 13 | /// Link to the DbContext that managers the cache store 14 | /// 15 | bool IsOutOfDateOrMissing(string cacheKey, string ticksToCompareString, ITimeStore timeStore); 16 | 17 | /// 18 | /// This adds or updates the TimeStore entry with the cacheKey with the cachedValue (datetime as ticks) 19 | /// 20 | /// 21 | void AddOrUpdate(ITimeStore timeStore); 22 | } 23 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.RefreshClaims/ITimeStore.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | namespace SoftinuxBase.Security.RefreshClaims 5 | { 6 | /// 7 | /// Access to the TimeStore part of the ExtraAuthorizeDbContext 8 | /// 9 | public interface ITimeStore 10 | { 11 | /// 12 | /// This reads the TimeStore entry with the given key. 13 | /// 14 | /// the cache key 15 | /// DateTime ticks value, or null if not set. 16 | long? GetValueFromStore(string key); 17 | 18 | /// 19 | /// This adds or updates the TimeStore entry defined by the key 20 | /// 21 | /// the cache key 22 | /// the new DateTime ticks value 23 | void AddUpdateValue(string key, long ticks); 24 | } 25 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.RefreshClaims/SoftinuxBase.Security.RefreshClaims.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.UserImpersonation/AppStart/StartupExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Extensions.DependencyInjection; 5 | using NetCore.AutoRegisterDi; 6 | 7 | namespace SoftinuxBase.Security.UserImpersonation.AppStart 8 | { 9 | public static class StartupExtensions 10 | { 11 | public static void UserImpersonationRegister(this IServiceCollection services_) 12 | { 13 | //This registers the classes in the current assembly that end in "Service" and have a public interface 14 | services_.RegisterAssemblyPublicNonGenericClasses() 15 | .Where(c => c.Name.EndsWith("Service")) 16 | .AsPublicImplementedInterfaces(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.UserImpersonation/Concrete/AuthCookieSignout.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Authentication.Cookies; 6 | 7 | namespace SoftinuxBase.Security.UserImpersonation.Concrete 8 | { 9 | public class AuthCookieSigningOut 10 | { 11 | /// 12 | /// This will ensure any impersonation cookie is deleted when a user signs out 13 | /// 14 | /// 15 | /// 16 | public Task SigningOutAsync(CookieSigningOutContext context_) 17 | { 18 | var cookie = new ImpersonationCookie(context_.HttpContext, null); 19 | cookie.Delete(); 20 | 21 | return Task.CompletedTask; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.UserImpersonation/Concrete/ImpersonationData.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace SoftinuxBase.Security.UserImpersonation.Concrete 7 | { 8 | /// 9 | /// This holds the data that will be put into the ImpersonationCookie 10 | /// 11 | public class ImpersonationData 12 | { 13 | /// 14 | /// UserId of the user you are impersonating 15 | /// 16 | public string UserId { get; } 17 | 18 | /// 19 | /// UserName of the impersonated user - used to show who you are impersonating 20 | /// 21 | public string UserName { get; } 22 | 23 | /// 24 | /// If true then when impersonating another user you will keep your original permissions 25 | /// 26 | public bool KeepOwnPermissions { get; } 27 | 28 | public ImpersonationData(string userId_, string userName_, bool keepOwnPermissions_) 29 | { 30 | UserId = userId_ ?? throw new ArgumentNullException(nameof(userId_)); 31 | UserName = userName_ ?? throw new ArgumentNullException(nameof(userName_)); 32 | KeepOwnPermissions = keepOwnPermissions_; 33 | } 34 | 35 | public ImpersonationData(string packedString_) 36 | { 37 | var split = packedString_.Split(','); 38 | if (split.Length != 3) 39 | throw new ArgumentException("The string didn't unpack to three items"); 40 | 41 | UserId = split[0]; 42 | KeepOwnPermissions = bool.Parse(split[1]); 43 | UserName = split[2]; 44 | } 45 | 46 | public string GetPackImpersonationData() 47 | { 48 | return $"{UserId},{KeepOwnPermissions},{UserName}"; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.UserImpersonation/IImpersonationService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | namespace SoftinuxBase.Security.UserImpersonation 4 | { 5 | public interface IImpersonationService 6 | { 7 | /// 8 | /// This creates an user impersonation cookie, which starts the user impersonation via the AuthCookie ValidateAsync event 9 | /// 10 | /// This must be the userId of the user you want to impersonate 11 | /// the name to show as being impersonated 12 | /// true if the original user's permissions should be used 13 | /// error message, or null if OK 14 | string StartImpersonation(string userId_, string userName_, bool keepOwnPermissions_); 15 | 16 | /// 17 | /// This will delete the user impersonation cookie, which causes the AuthCookie ValidateAsync event to revert to the original user 18 | /// 19 | /// error message, or null if OK 20 | string StopImpersonation(); 21 | } 22 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.UserImpersonation/ImpersonateExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/ 2 | // Licensed under MIT license. See License.txt in the project root for license information. 3 | 4 | using System.Linq; 5 | using System.Security.Claims; 6 | using Microsoft.AspNetCore.Html; 7 | using SoftinuxBase.Security.UserImpersonation.Concrete; 8 | 9 | namespace SoftinuxBase.Security.UserImpersonation 10 | { 11 | public static class ImpersonateExtensions 12 | { 13 | public static bool InImpersonationMode(this ClaimsPrincipal claimsPrincipal_) 14 | { 15 | return claimsPrincipal_.Claims.Any(x => x.Type == ImpersonationHandler.ImpersonationClaimType); 16 | } 17 | 18 | public static string GetImpersonatedUserNameMode(this ClaimsPrincipal claimsPrincipal_) 19 | { 20 | return claimsPrincipal_.Claims.SingleOrDefault(x => x.Type == ImpersonationHandler.ImpersonationClaimType)?.Value; 21 | } 22 | 23 | public static HtmlString GetCurrentUserNameAsHtml(this ClaimsPrincipal claimsPrincipal_) 24 | { 25 | var impersonalisedName = claimsPrincipal_.GetImpersonatedUserNameMode(); 26 | var nameToShow = impersonalisedName ?? 27 | claimsPrincipal_.Claims.SingleOrDefault(x => x.Type == ClaimTypes.Name)?.Value ?? 28 | "not logged in"; 29 | 30 | return new HtmlString( 31 | "Impersonating " : ">Hello ") 32 | + $"{nameToShow}"); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security.UserImpersonation/SoftinuxBase.Security.UserImpersonation.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/Controllers/AdministrationController.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | using ExtCore.Data.Abstractions; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.Extensions.Logging; 8 | using SoftinuxBase.Security.FeatureAuthorize.PolicyCode; 9 | 10 | namespace SoftinuxBase.Security.Controllers 11 | { 12 | [HasPermission(typeof(Permissions.Enums.Permissions), (short)Permissions.Enums.Permissions.Admin)] 13 | public class AdministrationController : Infrastructure.ControllerBase 14 | { 15 | private readonly ILogger _logger; 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// application storage instance. 21 | /// application logger factory instance. 22 | public AdministrationController(IStorage storage_, ILoggerFactory loggerFactory_) : base(storage_, loggerFactory_) 23 | { 24 | _logger = LoggerFactory?.CreateLogger(GetType().FullName); 25 | _logger?.LogInformation("oups"); 26 | } 27 | 28 | /// 29 | /// Administration Index view. 30 | /// 31 | /// administration Index view. 32 | [HttpGet] 33 | [ActionName("Index")] 34 | public async Task IndexAsync() 35 | { 36 | return await Task.Run(() => View("Administration")); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/MD5Hasher.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using System.Security.Cryptography; 6 | using System.Text; 7 | 8 | namespace SoftinuxBase.Security 9 | { 10 | public static class MD5Hasher 11 | { 12 | public static string ComputeHash(string data) 13 | { 14 | return BitConverter.ToString(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(data))); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ServiceConfiguration/ActivateAuthentication.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using ExtCore.Infrastructure.Actions; 6 | using Microsoft.AspNetCore.Builder; 7 | 8 | namespace SoftinuxBase.Security.ServiceConfiguration 9 | { 10 | /// 11 | /// Activates the authentication. 12 | /// 13 | public class ActivateAuthentication : IConfigureAction 14 | { 15 | /// 16 | public int Priority => 200; 17 | 18 | /// 19 | public void Execute(IApplicationBuilder applicationBuilder_, IServiceProvider serviceProvider_) 20 | { 21 | applicationBuilder_.UseAuthentication(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ServiceConfiguration/ConfigureAction.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using ExtCore.Infrastructure.Actions; 6 | using Microsoft.AspNetCore.Builder; 7 | 8 | namespace SoftinuxBase.Security.ServiceConfiguration 9 | { 10 | /// 11 | /// Action that must be executed inside the Configure method of a web application's Startup class: 12 | /// 13 | /// Activates the authentication. 14 | /// 15 | public class ConfigureAction : IConfigureAction 16 | { 17 | /// 18 | public int Priority => 200; 19 | 20 | /// 21 | public void Execute(IApplicationBuilder applicationBuilder_, IServiceProvider serviceProvider_) 22 | { 23 | applicationBuilder_.UseAuthentication(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ServiceConfiguration/ConfigureAuthentication.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using System.Net; 6 | using System.Threading.Tasks; 7 | using ExtCore.Infrastructure.Actions; 8 | using Microsoft.AspNetCore.Authentication; 9 | using Microsoft.AspNetCore.Authentication.Cookies; 10 | using Microsoft.Extensions.DependencyInjection; 11 | 12 | namespace SoftinuxBase.Security.ServiceConfiguration 13 | { 14 | /// 15 | /// Configuration of application services to activate authenticated access. 16 | /// This class is Internal to SoftinuxBase.Security. 17 | /// 18 | internal class ConfigureAuthentication : IConfigureServicesAction 19 | { 20 | public int Priority => 200; 21 | 22 | /// 23 | public void Execute(IServiceCollection serviceCollection_, IServiceProvider serviceProvider_) 24 | { 25 | } 26 | 27 | // TODO duplicate code - remove if unused 28 | 29 | /// 30 | /// Suppress redirect on API URLs. 31 | /// 32 | /// Status code. 33 | /// Function. 34 | private static Func, Task> ReplaceRedirectorWithStatusCode( 35 | HttpStatusCode statusCode_) => context_ => 36 | { 37 | // Adapted from https://stackoverflow.com/questions/42030137/suppress-redirect-on-api-urls-in-asp-net-core 38 | context_.Response.StatusCode = (int)statusCode_; 39 | return Task.CompletedTask; 40 | }; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/Tools/CreateRole.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Identity; 7 | using SoftinuxBase.Infrastructure.Interfaces; 8 | using SoftinuxBase.Security.ViewModels.Permissions; 9 | 10 | namespace SoftinuxBase.Security.Tools 11 | { 12 | /// 13 | /// The main CreateRoleAndGrants class. 14 | /// 15 | /// Contains all methods for reading granting permissions. 16 | /// 17 | public static class CreateRole 18 | { 19 | /// 20 | /// Check that a role with this name doesn't already exist then save new role into database. 21 | /// 22 | /// Base's custom interface to . 23 | /// A object. 24 | /// Null if success, otherwise error message. 25 | public static async Task CheckAndSaveNewRoleAsync(IAspNetRolesManager rolesManager_, SaveNewRoleViewModel model_) 26 | { 27 | if (await rolesManager_.FindByNameAsync(model_.RoleName) != null) 28 | { 29 | return "A role with this name already exists"; 30 | } 31 | 32 | try 33 | { 34 | // Save the Role 35 | IdentityRole identityRole = new IdentityRole 36 | { 37 | // Auto-incremented ID 38 | Name = model_.RoleName 39 | }; 40 | await rolesManager_.CreateAsync(identityRole); 41 | 42 | return null; 43 | } 44 | catch (Exception e) 45 | { 46 | return $"{e.Message} {e.StackTrace}"; 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewComponents/AddRoleListExtensionsViewComponent.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | using ExtCore.Data.Abstractions; 6 | using Microsoft.AspNetCore.Mvc; 7 | using SoftinuxBase.Barebone.ViewComponents; 8 | 9 | namespace SoftinuxBase.Security.ViewComponents 10 | { 11 | public class AddRoleListExtensionsViewComponent : ViewComponentBase 12 | { 13 | public AddRoleListExtensionsViewComponent(IStorage storage_) : base(storage_) 14 | { 15 | } 16 | 17 | public Task InvokeAsync() 18 | { 19 | return Task.FromResult(View("_AddRoleListExtensions")); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewComponents/EditRolePermissionsViewComponent.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | using ExtCore.Data.Abstractions; 6 | using Microsoft.AspNetCore.Mvc; 7 | using SoftinuxBase.Barebone.ViewComponents; 8 | 9 | namespace SoftinuxBase.Security.ViewComponents 10 | { 11 | public class EditRolePermissionsViewComponent : ViewComponentBase 12 | { 13 | public EditRolePermissionsViewComponent(IStorage storage_) : base(storage_) 14 | { 15 | } 16 | 17 | public Task InvokeAsync() 18 | { 19 | return Task.FromResult(View("_Edit_Role_Permissions")); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewComponents/SelectOptionsListRolesViewComponent.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using ExtCore.Data.Abstractions; 8 | using Microsoft.AspNetCore.Mvc; 9 | using SoftinuxBase.Barebone.ViewComponents; 10 | using SoftinuxBase.Infrastructure.Interfaces; 11 | using SoftinuxBase.Security.Data.Abstractions; 12 | 13 | namespace SoftinuxBase.Security.ViewComponents 14 | { 15 | public class SelectOptionsListRolesViewComponent : ViewComponentBase 16 | { 17 | private readonly IAspNetRolesManager _rolesManager; 18 | 19 | public SelectOptionsListRolesViewComponent(IStorage storage_, IAspNetRolesManager rolesManager_) : base(storage_) 20 | { 21 | _rolesManager = rolesManager_; 22 | } 23 | 24 | public Task InvokeAsync() 25 | { 26 | HashSet listNamesOfRolesWithPermissions = Storage.GetRepository().All().Where(rp_ => rp_.PermissionsForRole.Any()).Select(rp_ => rp_.RoleName).ToHashSet(); 27 | return Task.FromResult(View("_SelectOptionsListRoles", (_rolesManager, listNamesOfRolesWithPermissions))); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewModels/Account/CreateOrEditUserViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Security.ViewModels.Account 5 | { 6 | public class CreateOrEditUserViewModel 7 | { 8 | public Data.Entities.User User { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewModels/Account/SignInViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | namespace SoftinuxBase.Security.ViewModels.Account 7 | { 8 | public class SignInViewModel 9 | { 10 | /// 11 | /// Gets or sets the user id, if any match. 12 | /// 13 | public int? Id { get; set; } 14 | 15 | /// 16 | /// Gets or sets user name or e-mail field. 17 | /// 18 | [Display(Name = "Username or e-mail")] 19 | [Required] 20 | [StringLength(64)] 21 | public string Username { get; set; } 22 | 23 | /// 24 | /// Gets or sets password field. 25 | /// 26 | [Display(Name = "Password")] 27 | [Required] 28 | [StringLength(64)] 29 | public string Password { get; set; } 30 | 31 | /// 32 | /// Gets or sets a value indicating whether use persistent cookie if desired. 33 | /// 34 | [Display(Name = "Remember me")] 35 | public bool RememberMe { get; set; } 36 | 37 | public string ErrorMessage { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewModels/Account/SignUpViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.ComponentModel.DataAnnotations; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace SoftinuxBase.Security.ViewModels.Account 8 | { 9 | public class SignUpViewModel 10 | { 11 | /// 12 | /// Gets or sets first name field. 13 | /// 14 | [Required] 15 | [Display(Name = "User Name")] 16 | [StringLength(256, ErrorMessage = "The {0} must be between {2} and {1} characters long.", MinimumLength = 4)] 17 | [Remote("CheckUserNameExist", "Account", HttpMethod = "POST", ErrorMessage = "User name already taken.")] 18 | public string UserName { get; set; } 19 | 20 | /// 21 | /// Gets or sets e-mail field. 22 | /// 23 | [Display(Name = "Email")] 24 | [DataType(DataType.EmailAddress)] 25 | [RegularExpression("^[0-9a-z-A-Z]+([0-9a-z-A-Z]*[-._+])*[0-9a-z-A-Z]+@[0-9a-z-A-Z]+([-.][0-9a-z-A-Z]+)*([0-9a-z-A-Z]*[.])[a-zA-Z]{2,6}$", ErrorMessage = "Incorrect Email format!")] 26 | [Required] 27 | [StringLength(256)] 28 | public string Email { get; set; } 29 | 30 | /// 31 | /// Gets or sets password field. 32 | /// 33 | [Display(Name = "Password")] 34 | [DataType(DataType.Password)] 35 | 36 | // [CustomValidation(typeof(Security.Permissions.Attributes.PasswordAttributes),"PasswordStrongTest")] 37 | [Required] 38 | [StringLength(10, MinimumLength = 8)] 39 | public string Password { get; set; } 40 | 41 | public string ErrorMessage { get; set; } 42 | } 43 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewModels/Permissions/DeleteRoleExtensionLinkViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Security.ViewModels.Permissions 5 | { 6 | public class DeleteRoleExtensionLinkViewModel 7 | { 8 | public string RoleName { get; set; } 9 | public string ExtensionName { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewModels/Permissions/ExtensionPermissionValue.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Security.ViewModels.Permissions 5 | { 6 | public class ExtensionPermissionValue 7 | { 8 | public string Extension { get; set; } 9 | 10 | /// 11 | /// Gets or sets value of the Permission enum. 12 | /// 13 | public string PermissionValue { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewModels/Permissions/ReadRoleViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using Microsoft.AspNetCore.Identity; 6 | 7 | namespace SoftinuxBase.Security.ViewModels.Permissions 8 | { 9 | /// 10 | /// All the data related to a role, to display for edition of this role. 11 | /// 12 | public class ReadRoleViewModel 13 | { 14 | public IdentityRole Role { get; set; } 15 | public IList SelectedExtensions { get; set; } 16 | public IList AvailableExtensions { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewModels/Permissions/SaveNewRoleViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Security.ViewModels.Permissions 5 | { 6 | /// 7 | /// The posted data when adding a new role: role name. 8 | /// 9 | public class SaveNewRoleViewModel 10 | { 11 | public string RoleName { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewModels/Permissions/SelectedExtension.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace SoftinuxBase.Security.ViewModels.Permissions 7 | { 8 | /// 9 | /// An extension name and its , grouped by permission section, each permission display having a selection indicator to describe a link to an entity like a role or a user. 10 | /// 11 | public class SelectedExtension 12 | { 13 | public SelectedExtension(string extensionName_) 14 | { 15 | ExtensionName = extensionName_; 16 | GroupedBySectionPermissionDisplays = new Dictionary>(); 17 | } 18 | 19 | public string ExtensionName { get; } 20 | 21 | public Dictionary> GroupedBySectionPermissionDisplays { get; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewModels/Permissions/UpdateRolePermissionViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | namespace SoftinuxBase.Security.ViewModels.Permissions 7 | { 8 | public class UpdateRolePermissionViewModel 9 | { 10 | #pragma warning disable SA1623 // PropertySummaryDocumentationMustMatchAccessors 11 | /// 12 | /// Name of role. 13 | /// 14 | [Required] 15 | public string RoleName { get; set; } 16 | 17 | /// 18 | /// Name of extension. 19 | /// 20 | [Required] 21 | public string ExtensionName { get; set; } 22 | 23 | /// 24 | /// Permission value (a value of the enum associated to the extension). 25 | /// 26 | public short PermissionValue { get; set; } 27 | 28 | /// 29 | /// When true, add a role to permission link, else remove. 30 | /// 31 | public bool Add { get; set; } 32 | 33 | #pragma warning restore SA1623 // PropertySummaryDocumentationMustMatchAccessors 34 | } 35 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/ViewModels/Permissions/UpdateRoleViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.Security.ViewModels.Permissions 5 | { 6 | /// 7 | /// The posted data when modifying a role. 8 | /// 9 | public class UpdateRoleViewModel 10 | { 11 | public string RoleId { get; set; } 12 | public string RoleName { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/Views/Account/AccessDenied.cshtml: -------------------------------------------------------------------------------- 1 | @* Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 3 | *@ 4 | 5 | @using System.Web 6 | 7 | @{ 8 | string url = HttpUtility.UrlDecode(Context.Request.QueryString.ToUriComponent()); 9 | ViewBag.currentUrl = url.Substring(url.IndexOf('=')+1); 10 | } 11 | @* ReSharper disable once Razor.SectionNotResolved *@ 12 | @section title { 13 |

Access Denied

14 | } 15 | 16 |
17 |
18 |
19 |
20 | 21 |
22 |
23 |
24 | 27 |
28 |
29 |
30 | 31 |
32 |
33 |
34 |
35 | 36 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/Views/Administration/Administration.cshtml: -------------------------------------------------------------------------------- 1 | @* Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 3 | *@ 4 | 5 | @* ReSharper disable once Razor.SectionNotResolved *@ 6 | @section title { 7 | Administration 8 | } 9 |
10 |
11 | 19 |
20 | 21 | 22 | 23 | 26 |
27 |
28 |
29 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/Views/ListUsers/Admin_Edit_User.cshtml: -------------------------------------------------------------------------------- 1 | @* Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 3 | *@ 4 | 5 | @{ 6 | Layout = "_Layout_Edit_User_Admin"; 7 | } 8 | 9 | @model SoftinuxBase.Security.Data.Entities.User 10 | 11 |
12 | 13 |
14 | 15 |
16 |
17 |
18 | 19 |
20 | 21 |
22 |
23 |
24 |
25 | 26 | 27 |
28 |
29 |
30 |
31 | 32 | 33 |
34 |
35 | 36 | @await Html.PartialAsync("_User_Profile_Details_Fields") 37 | 38 | @section Scripts { 39 | @* If useful, include .js or .min.js version depending upon ViewBag.IsDebug 40 | *@ 41 | } 42 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/Views/Shared/Components/AddRoleListExtensions/_AddRoleListExtensions.cshtml: -------------------------------------------------------------------------------- 1 | @* Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 3 | *@ 4 | 5 | @using ExtCore.Infrastructure 6 | @using SoftinuxBase.Infrastructure.Interfaces 7 | 8 | @{ 9 | foreach (IExtensionMetadata extensionMetadata in ExtensionManager.GetInstances()) 10 | { 11 | var scope = extensionMetadata.Name; 12 | if (extensionMetadata.Permissions != null) 13 | { 14 | 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/Views/Shared/Components/SelectOptionsListRoles/_SelectOptionsListRoles.cshtml: -------------------------------------------------------------------------------- 1 | @* Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 3 | *@ 4 | @model (SoftinuxBase.Infrastructure.Interfaces.IAspNetRolesManager roleManager, HashSet listNamesOfRolesWithPermissions) 5 | 6 | 7 | @* here roles list *@ 8 | @foreach (var role in Model.roleManager.Roles.OrderBy(role => role.Name)) 9 | { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/Views/Shared/_Layout_Edit_User_Admin.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | Copyright © 2017 SOFTINUX. All rights reserved. 3 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 4 | *@ 5 | 6 | @RenderBody() 7 | 8 | @RenderSection("Scripts", false) -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/Views/Shared/_User_Profile_Details_Card.cshtml: -------------------------------------------------------------------------------- 1 | @* Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. 3 | *@ 4 | 5 | @* Profile Image *@ 6 | User profile picture 7 |

@Model.FirstName @Model.LastName

8 |

@Model.Email

9 | 23 | -------------------------------------------------------------------------------- /src/SoftinuxBase.Security/bundleconfig.json.bindings: -------------------------------------------------------------------------------- 1 | produceoutput=true -------------------------------------------------------------------------------- /src/SoftinuxBase.SeedDatabase/Constants.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | namespace SoftinuxBase.SeedDatabase 5 | { 6 | public enum Role 7 | { 8 | /// 9 | /// Administrator role. 10 | /// 11 | Administrator, 12 | 13 | /// 14 | /// User role. 15 | /// 16 | User, 17 | 18 | /// 19 | /// Anonymous role. 20 | /// 21 | Anonymous 22 | } 23 | 24 | public static class Constants 25 | { 26 | public static string GetRoleName(this Role role) // convenience method 27 | { 28 | return role.ToString(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/SoftinuxBase.SeedDatabase/ExtensionMetadata.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2017-2019 SOFTINUX. All rights reserved. 2 | // Licensed under the MIT License, Version 2.0. See LICENSE file in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Reflection; 7 | using SoftinuxBase.Infrastructure; 8 | using SoftinuxBase.Infrastructure.Interfaces; 9 | 10 | namespace SoftinuxBase.SeedDatabase 11 | { 12 | public class ExtensionMetadata : IExtensionMetadata 13 | { 14 | /// 15 | public Assembly CurrentAssembly => Assembly.GetExecutingAssembly(); 16 | 17 | /// 18 | public string CurrentAssemblyPath => CurrentAssembly.Location; 19 | 20 | /// 21 | public Type Permissions => null; 22 | 23 | /// 24 | public string FileExtensionPrefix => string.Empty; 25 | 26 | /// 27 | public string Name => CurrentAssembly.GetName().Name; 28 | 29 | /// 30 | public string Url => Attribute.GetCustomAttribute(CurrentAssembly, typeof(AssemblyTitleAttribute))?.ToString(); 31 | 32 | /// 33 | public string Version => Attribute.GetCustomAttribute(CurrentAssembly, typeof(AssemblyVersionAttribute))?.ToString(); 34 | 35 | /// 36 | public string Authors => Attribute.GetCustomAttribute(CurrentAssembly, typeof(AssemblyCompanyAttribute))?.ToString(); 37 | 38 | /// 39 | public string Description => Attribute.GetCustomAttribute(CurrentAssembly, typeof(AssemblyDescriptionAttribute))?.ToString(); 40 | 41 | /// 42 | public IEnumerable StyleSheets => new StyleSheet[] { }; 43 | 44 | /// 45 | public IEnumerable