Skip to content

Instantly share code, notes, and snippets.

View BartDM's full-sized avatar

Bart De Meyer BartDM

View GitHub Profile
@BartDM
BartDM / gist:5204069
Created March 20, 2013 11:48
Source for blog post Creating a JIRA interface in 1-2-3 on http://blog.bartdemeyer.be
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Web;
using System.Web.Mvc;
using Atlassian.Jira;
using JiraInterface.Models;
@BartDM
BartDM / gist:5204168
Created March 20, 2013 12:08
Source for blog post Creating a JIRA interface in 1-2-3 on http://blog.bartdemeyer.be
public ActionResult Create()
{
return View();
}
[HttpPost]
public ActionResult Create(Issue issue)
{
try
{
@BartDM
BartDM / gist:5204225
Created March 20, 2013 12:17
Source for blog post Creating a JIRA interface in 1-2-3 on http://blog.bartdemeyer.be
PM> Install-Package Twitter.Bootstrap.MVC
using System.Web;
using System.Web.Optimization;
namespace JiraInterface
{
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
@BartDM
BartDM / gist:5204260
Created March 20, 2013 12:22
Source for blog post Creating a JIRA interface in 1-2-3 on http://blog.bartdemeyer.be
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrapper")
@RenderSection("scripts", required: false)
<?xml version="1.0" encoding="utf-8" ?>
<JiraCredentials>
<Url>JIRA_URL</Url>
<User>USERNAME</User>
<Password>PASSWORD</Password>
<MailFrom>MAILFROM_ADDRESS</MailFrom>
<MailTo>MAILTO_ADDRESS</MailTo>
</JiraCredentials>
@BartDM
BartDM / gist:5282022
Created March 31, 2013 21:13
Source code for blog post Securing Backend Pages in MVC for Umbraco 4.11.1 on blog.bartdemeyer.be
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using Umbraco.Core;
namespace UmbracoMVCDemo.BackEnd.Helpers
{
public class UmbracoAuthorizeAttribute : AuthorizeAttribute
{
@BartDM
BartDM / gist:5282045
Created March 31, 2013 21:23
Source code for blog post Securing Backend Pages in MVC for Umbraco 4.11.1 on blog.bartdemeyer.be
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
if (httpContext == null)
{
throw new ArgumentNullException("httpContext");
}
try
{
failedAuthentication = !umbraco.BasePages.BasePage.ValidateUserContextID(umbraco.BasePages.BasePage.umbracoUserContextID);
return !failedAuthentication;
@BartDM
BartDM / gist:5282097
Created March 31, 2013 21:37
Source code for blog post Securing Backend Pages in MVC for Umbraco 4.11.1 on blog.bartdemeyer.be
public override void OnAuthorization(AuthorizationContext filterContext)
{
base.OnAuthorization(filterContext);
if(failedAuthentication)
FormsAuthentication.RedirectToLoginPage();
}
@BartDM
BartDM / gist:5282141
Created March 31, 2013 21:50
Source code for blog post Securing Backend Pages in MVC for Umbraco 4.11.1 on blog.bartdemeyer.be
namespace UmbracoMVCDemo.BackEnd.Controllers
{
[PluginController("Demo")]
[UmbracoAuthorize]
public class DemoAdminSurfaceController : SurfaceController
{
public DemoAdminSurfaceController()
{