Skip to content

Instantly share code, notes, and snippets.

View hawjeh's full-sized avatar

Haw Jeh Lee hawjeh

View GitHub Profile
@hawjeh
hawjeh / UserReportService.cs
Last active March 19, 2024 06:26
User Access Report
using System;
using System.Collections.Generic;
using System.Linq;
using Telerik.Sitefinity.Modules.Pages;
using Telerik.Sitefinity.Multisite;
using Telerik.Sitefinity.Pages.Model;
using Telerik.Sitefinity.Security;
using Telerik.Sitefinity.Security.Model;
namespace SitefinityWebApp.Api.Services
@hawjeh
hawjeh / CreateUserFromSaml.cs
Created December 4, 2023 04:59
Sitefinity Azure AD SAML SSO Login Integration
public void CreateUserFromSaml(Guid userId, string userEmail)
{
try
{
var user = userManager.GetUser(userId);
if (user != null)
{
var firstName = Cache.GetData(userEmail + AuthConstant.FirstNameKey).ToString();
var lastName = Cache.GetData(userEmail + AuthConstant.LastNameKey).ToString();
@hawjeh
hawjeh / AuditReport.cshtml
Created December 4, 2023 03:47
Sitefinity Access Logs to Azure Storage
@using Newtonsoft.Json;
@model SitefinityWebApp.Mvc.Models.ReportModel
@{
Layout = "~/Mvc/Views/Shared/Admin/_AdminLayout.cshtml";
}
@section head{
<style>
thead[role=rowgroup] {
@hawjeh
hawjeh / SparksAppSetting.cs
Created May 5, 2023 10:31
SparksCloudFront
namespace SparksCloudFront
{
public class SparksAppSetting
{
public CloudFront CloudFront { get; set; }
}
public class CloudFront
{
public string Profile { get; set; }
@hawjeh
hawjeh / Content_Pages_login.html
Created May 3, 2023 07:08
Sitefinity v13 Custom Reset Password
<!DOCTYPE html>
<html ng-app="app" ng-controller="LayoutCtrl">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>{siteName}</title>
<style>
img {
width: 100px;
height: 100px;
@hawjeh
hawjeh / download.js
Last active June 2, 2022 10:26
Download_media_files_from_from_links_txt
var https = require('https'),
fs = require('fs'),
readline = require('readline');
const baseUrl = process.argv.slice(2)[0]; // Page domain url e.g. https://www.google.com
const processName = process.argv.slice(2)[1]; // Filename without <filename>_links.txt
var download = function (url, dir, dest, cb) {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
@hawjeh
hawjeh / remove_tags.ps1
Created June 17, 2021 02:26
Batch Remove Azure DevOps Tags
try {
$cred = Get-Credential
$list = Invoke-RestMethod -Uri "https://<domain>/<Organization>/<Project>/_apis/git/repositories/<Repository>/refs?filter=tags/&api-version=6.0-preview.1" -Credential $cred
foreach ($l in $list.value)
{
Invoke-WebRequest -Uri "https://<domain>/<Organization>/<Project>/_apis/git/repositories/<Repository>/refs?api-version=6.0" -Credential $cred -ContentType "application/json" -Method POST -Body "[{'name':'$($l.name)','newObjectId':'0000000000000000000000000000000000000000','oldObjectId':'$($l.objectId)'}]"
}
Write-Host "End of Work"
@hawjeh
hawjeh / Index.cshtml
Last active February 26, 2021 09:40
Sitefinity Field Migration Tool
@if (ViewBag.IsUserInRole)
{
<section class="container">
<div class="row" style="margin: 30px">
<div>
<h3>Migration Service</h3>
</div>
<br>
<div class="col-12 form-group">
<label>Service:</label>
<!DOCTYPE html>
<html ng-app="app" ng-controller="LayoutCtrl">
<head>
<title>{siteName}</title>
<style>
img {
width: 100px;
height: 100px;
}
@hawjeh
hawjeh / CustomFormModel.cs
Created January 18, 2021 02:32
Get All Form Fields
public class CustomFormModel
{
public Guid Id { get; set; }
public string FormTitle { get; set; }
public string SuccessMessage { get; set; }
public List<CustomFormField> Fields { get; set; } = new List<CustomFormField>();
}
public class CustomFormField
{