Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Squidex/squidex
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Dec 23, 2018
2 parents c249ad0 + 9b5c903 commit 1131e4f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Squidex.Domain.Apps.Entities/Apps/RoleExtensions.cs
Expand Up @@ -30,7 +30,7 @@ public static string[] Prefix(this string[] permissions, string name)
}
}

permissions = result;
permissions = result.Distinct().ToArray();

return permissions;
}
Expand Down
6 changes: 6 additions & 0 deletions src/Squidex.Domain.Users/UserWithClaims.cs
Expand Up @@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
Expand All @@ -30,6 +31,11 @@ public string Email
get { return Identity.Email; }
}

public bool IsLocked
{
get { return Identity.LockoutEnd > DateTime.Now.ToUniversalTime(); }
}

IReadOnlyList<Claim> IUser.Claims
{
get { return Claims; }
Expand Down
2 changes: 2 additions & 0 deletions src/Squidex.Shared/Users/IUser.cs
Expand Up @@ -16,6 +16,8 @@ public interface IUser

string Email { get; }

bool IsLocked { get; }

IReadOnlyList<Claim> Claims { get; }
}
}
Expand Up @@ -65,7 +65,7 @@ export class IFrameEditorComponent implements ControlValueAccessor, AfterViewIni
this.isInitialized = true;

if (this.plugin.contentWindow && Types.isFunction(this.plugin.contentWindow.postMessage)) {
this.plugin.contentWindow.postMessage({ type: 'disabled', disabled: this.isDisabled }, '*');
this.plugin.contentWindow.postMessage({ type: 'disabled', isDisabled: this.isDisabled }, '*');
this.plugin.contentWindow.postMessage({ type: 'valueChanged', value: this.value }, '*');
}
} else if (type === 'resize') {
Expand Down Expand Up @@ -99,7 +99,7 @@ export class IFrameEditorComponent implements ControlValueAccessor, AfterViewIni
this.isDisabled = isDisabled;

if (this.isInitialized && this.plugin.contentWindow && Types.isFunction(this.plugin.contentWindow.postMessage)) {
this.plugin.contentWindow.postMessage({ type: 'disabled', disabled: this.isDisabled }, '*');
this.plugin.contentWindow.postMessage({ type: 'disabled', isDisabled: this.isDisabled }, '*');
}
}

Expand Down
Expand Up @@ -12,7 +12,7 @@

namespace Squidex.Domain.Apps.Entities.Apps
{
public class RoleExtensionsRests
public class RoleExtensionsTests
{
[Fact]
public void Should_add_common_permission()
Expand All @@ -23,6 +23,15 @@ public void Should_add_common_permission()
Assert.Equal(new[] { "squidex.apps.my-app.common" }, result);
}

[Fact]
public void Should_not_have_duplicate_permission()
{
var source = new[] { "common", "common", "common" };
var result = source.Prefix("my-app");

Assert.Single(result);
}

[Fact]
public void Should_prefix_permission()
{
Expand Down

0 comments on commit 1131e4f

Please sign in to comment.