adds test to ensure the service level can remove a scheduled publish date, obsoletes method: GetHasPermission
This commit is contained in:
@@ -44,6 +44,27 @@ namespace Umbraco.Tests.Services
|
||||
//TODO Add test to verify there is only ONE newest document/content in cmsDocument table after updating.
|
||||
//TODO Add test to delete specific version (with and without deleting prior versions) and versions by date.
|
||||
|
||||
[Test]
|
||||
public void Remove_Scheduled_Publishing_Date()
|
||||
{
|
||||
// Arrange
|
||||
var contentService = ServiceContext.ContentService;
|
||||
|
||||
// Act
|
||||
var content = contentService.CreateContentWithIdentity("Test", -1, "umbTextpage", 0);
|
||||
|
||||
content.ReleaseDate = DateTime.Now.AddHours(2);
|
||||
contentService.Save(content, 0);
|
||||
|
||||
content = contentService.GetById(content.Id);
|
||||
content.ReleaseDate = null;
|
||||
contentService.Save(content, 0);
|
||||
|
||||
|
||||
// Assert
|
||||
Assert.IsTrue(contentService.PublishWithStatus(content).Success);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Count_All()
|
||||
{
|
||||
|
||||
@@ -495,7 +495,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"contentApiBaseUrl",
|
||||
"GetHasPermission",
|
||||
"HasPermission",
|
||||
[{ permissionToCheck: permission },{ nodeId: id }])),
|
||||
'Failed to check permission for item ' + id);
|
||||
},
|
||||
|
||||
@@ -181,8 +181,14 @@ namespace Umbraco.Web.Editors
|
||||
return pagedResult;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Obsolete("Dont use this, it is incorrectly named, use HasPermission instead")]
|
||||
public bool GetHasPermission(string permissionToCheck, int nodeId)
|
||||
{
|
||||
return HasPermission(permissionToCheck, nodeId);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public bool HasPermission(string permissionToCheck, int nodeId)
|
||||
{
|
||||
var p = Services.UserService.GetPermissions(Security.CurrentUser, nodeId).FirstOrDefault();
|
||||
if (p != null && p.AssignedPermissions.Contains(permissionToCheck.ToString(CultureInfo.InvariantCulture)))
|
||||
|
||||
Reference in New Issue
Block a user