Skip to content

Instantly share code, notes, and snippets.

View sadukie's full-sized avatar

Sarah Dutkiewicz sadukie

View GitHub Profile
@sadukie
sadukie / BlazorAdmin-Interfaces-IUserManagementService.cs
Last active April 11, 2025 20:30
eShopOnWeb - User Management - UI
using System.Threading.Tasks;
using BlazorAdmin.Models;
namespace BlazorAdmin.Interfaces;
public interface IUserManagementService
{
Task<CreateUserResponse> Create(CreateUserRequest user);
Task<GetUserResponse> Update(UpdateUserRequest user);
Task Delete(string id);
@sadukie
sadukie / ApplicationUserExtensions.cs
Last active April 10, 2025 13:54
eShopOnWeb - User Management - API + Tests
using Microsoft.eShopWeb.Infrastructure.Identity;
using Microsoft.eShopWeb.PublicApi.UserManagementEndpoints;
namespace Microsoft.eShopWeb.PublicApi.Extensions;
public static class ApplicationUserExtensions
{
public static UserDto ToUserDto(this ApplicationUser user)
{
UserDto dto = new UserDto();
@sadukie
sadukie / BlazorAdmin-Models-GetRoleMembershipRequest.cs
Last active April 3, 2025 20:12
Role Membership Code
using System.ComponentModel.DataAnnotations;
namespace BlazorAdmin.Models;
public class GetRoleMembershipRequest
{
public GetRoleMembershipRequest(string name)
{
Name = name;
@sadukie
sadukie / BlazorAdmin-CreateRoleRequest.cs
Last active April 3, 2025 18:43
eShopOnWeb-Add-Role-Management
using System.ComponentModel.DataAnnotations;
namespace BlazorAdmin.Models;
public class CreateRoleRequest
{
[Required(ErrorMessage = "The Name field is required")]
public string Name { get; set; }
}
@sadukie
sadukie / AddExternalLoginsToEShopLogin.cshtml
Last active April 1, 2025 22:51
ASP-NET-Core-Identity-in-Action-Implementing-Individual-Accounts
<div class="col-md-6 col-md-offset-2">
<section>
<h3>Use another service to log in.</h3>
<hr />
@{
if ((Model.ExternalLogins?.Count ?? 0) == 0)
{
<div>
<p>
There are no external authentication services configured. See this <a href="https://go.microsoft.com/fwlink/?LinkID=532715">article
@sadukie
sadukie / parse-wordpress-xml.ps1
Created October 7, 2024 01:23
Migrating from WordPress to some other site
# Export your WordPress content before running this script
# Set the output path
$sitePath = "PATH_TO_SITE_OUTPUT"
$siteUrl = "YOUR_SITE_URL"
# Parse the XML
[xml]$xml = Get-Content .\YOUR_WORDPRESS_EXPORT.xml
# $xml.rss.channel.item | Get-Member
foreach ($item in $xml.rss.channel.item){
@sadukie
sadukie / AuthenticatedPlaywrightDriver.cs
Created April 30, 2024 16:03
Using Shared State in Playwright for .NET
using Microsoft.Playwright;
using NimblePros.SuperSecretProject.FrontEndTests.PageObjects;
namespace NimblePros.SuperSecretProject.FrontEndTests;
internal class AuthenticatedPlaywrightDriver : IDisposable
{
private IPlaywright? _playwright;
private IBrowser? _browser;
private IBrowserContext? _context;
public AuthenticatedPlaywrightDriver()
@sadukie
sadukie / 0-getPasswordsDefaultAzureCredential.py
Last active October 17, 2022 14:47
Authentication with the Azure Identity SDK for Python
import os
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
keyVaultName = os.environ["KEY_VAULT_NAME"]
tenantId = os.environ["AZURE_TENANT_ID"]
secretName = "SecretPassword"
KVUri = f"https://{keyVaultName}.vault.azure.net"
# Breaking changes in 1.11.0