Add permissions for downloading LeafInput

This commit is contained in:
2020-08-08 21:43:12 -04:00
parent 2716b9bfb4
commit 5dfc65a83a
9 changed files with 109 additions and 51 deletions
+20
View File
@@ -0,0 +1,20 @@
using System;
using LeafWeb.Core.Entities;
using Umbraco.Web.Security;
namespace LeafWeb.WebCms.Utility
{
public static class Permissions
{
public static bool IsCurrentUserAdministrator()
{
var memberShipHelper = new MembershipHelper(Umbraco.Web.UmbracoContext.Current);
return memberShipHelper.IsMemberAuthorized(allowGroups: new[] {"Administrator"});
}
public static bool DoesBelongToUser(this LeafInput leafInput, string username)
{
return string.Equals(leafInput.Email, username, StringComparison.OrdinalIgnoreCase);
}
}
}