Revert "Temp8 tinymce"
This commit is contained in:
@@ -1,23 +1,30 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Net.Http;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using System.Web.Security;
|
||||
using AutoMapper;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Models.Mapping;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.UI;
|
||||
using Umbraco.Web.WebApi;
|
||||
using umbraco;
|
||||
using legacyUser = umbraco.BusinessLogic.User;
|
||||
using System.Net.Http;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Web.Security;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
@@ -28,45 +35,6 @@ namespace Umbraco.Web.Editors
|
||||
[PluginController("UmbracoApi")]
|
||||
public class CurrentUserController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns permissions for all nodes passed in for the current user
|
||||
/// </summary>
|
||||
/// <param name="nodeIds"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Dictionary<int, string[]> GetPermissions(int[] nodeIds)
|
||||
{
|
||||
var permissions = Services.UserService
|
||||
.GetPermissions(Security.CurrentUser, nodeIds);
|
||||
|
||||
var permissionsDictionary = new Dictionary<int, string[]>();
|
||||
foreach (var nodeId in nodeIds)
|
||||
{
|
||||
var aggregatePerms = permissions.GetAllPermissions(nodeId).ToArray();
|
||||
permissionsDictionary.Add(nodeId, aggregatePerms);
|
||||
}
|
||||
|
||||
return permissionsDictionary;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks a nodes permission for the current user
|
||||
/// </summary>
|
||||
/// <param name="permissionToCheck"></param>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public bool HasPermission(string permissionToCheck, int nodeId)
|
||||
{
|
||||
var p = Services.UserService.GetPermissions(Security.CurrentUser, nodeId).GetAllPermissions();
|
||||
if (p.Contains(permissionToCheck.ToString(CultureInfo.InvariantCulture)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves a tour status for the current user
|
||||
/// </summary>
|
||||
@@ -74,12 +42,12 @@ namespace Umbraco.Web.Editors
|
||||
/// <returns></returns>
|
||||
public IEnumerable<UserTourStatus> PostSetUserTour(UserTourStatus status)
|
||||
{
|
||||
if (status == null) throw new ArgumentNullException(nameof(status));
|
||||
if (status == null) throw new ArgumentNullException("status");
|
||||
|
||||
List<UserTourStatus> userTours;
|
||||
if (Security.CurrentUser.TourData.IsNullOrWhiteSpace())
|
||||
{
|
||||
userTours = new List<UserTourStatus> { status };
|
||||
userTours = new List<UserTourStatus> {status};
|
||||
Security.CurrentUser.TourData = JsonConvert.SerializeObject(userTours);
|
||||
Services.UserService.Save(Security.CurrentUser);
|
||||
return userTours;
|
||||
@@ -124,7 +92,7 @@ namespace Umbraco.Web.Editors
|
||||
[OverrideAuthorization]
|
||||
public async Task<UserDetail> PostSetInvitedUserPassword([FromBody]string newPassword)
|
||||
{
|
||||
var result = await UserManager.AddPasswordAsync(Security.GetUserId().ResultOr(0), newPassword);
|
||||
var result = await UserManager.AddPasswordAsync(Security.GetUserId(), newPassword);
|
||||
|
||||
if (result.Succeeded == false)
|
||||
{
|
||||
@@ -157,7 +125,7 @@ namespace Umbraco.Web.Editors
|
||||
public async Task<HttpResponseMessage> PostSetAvatar()
|
||||
{
|
||||
//borrow the logic from the user controller
|
||||
return await UsersController.PostSetAvatarInternal(Request, Services.UserService, Current.ApplicationCache.StaticCache, Security.GetUserId().ResultOr(0));
|
||||
return await UsersController.PostSetAvatarInternal(Request, Services.UserService, ApplicationContext.ApplicationCache.StaticCache, Security.GetUserId());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user