@ -0,0 +1,20 @@
|
||||
# Angular UI: Current User
|
||||
|
||||
The current user information stored in Config State.
|
||||
|
||||
### How to Get a Current User Information Configuration
|
||||
|
||||
You can use the `getOne` or `getOne$` method of `ConfigStateService` to get a specific configuration property. For that, the property name should be passed to the method as parameter.
|
||||
|
||||
```js
|
||||
// this.config is an instance of ConfigStateService
|
||||
|
||||
const currentUser = this.config.getOne("currentUser");
|
||||
|
||||
// or
|
||||
this.config.getOne$("currentUser").subscribe(currentUser => {
|
||||
// use currentUser here
|
||||
})
|
||||
```
|
||||
|
||||
> See the [ConfigStateService](./Config-State-Service) for more information.
|
||||
|
Before Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 220 KiB |
|
Before Width: | Height: | Size: 487 KiB |
|
Before Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 368 KiB |
|
Before Width: | Height: | Size: 281 KiB |
|
Before Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 418 KiB |
|
Before Width: | Height: | Size: 275 KiB |
|
Before Width: | Height: | Size: 291 KiB |
|
Before Width: | Height: | Size: 491 KiB |
|
Before Width: | Height: | Size: 205 KiB |
|
Before Width: | Height: | Size: 539 KiB |
|
Before Width: | Height: | Size: 415 KiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 237 KiB |
|
Before Width: | Height: | Size: 352 KiB |
|
Before Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 295 KiB |
|
Before Width: | Height: | Size: 219 KiB |
|
Before Width: | Height: | Size: 288 KiB |
|
Before Width: | Height: | Size: 309 KiB |
|
Before Width: | Height: | Size: 304 KiB |
@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\..\configureawait.props" />
|
||||
<Import Project="..\..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.Dapr\Volo.Abp.AspNetCore.Mvc.Dapr.csproj" />
|
||||
<ProjectReference Include="..\Volo.Abp.EventBus.Dapr\Volo.Abp.EventBus.Dapr.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\..\configureawait.props" />
|
||||
<Import Project="..\..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" />
|
||||
<ProjectReference Include="..\Volo.Abp.Dapr\Volo.Abp.Dapr.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapr.AspNetCore" Version="1.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -0,0 +1,14 @@
|
||||
using JetBrains.Annotations;
|
||||
using Volo.Abp.Localization;
|
||||
using Volo.Abp.MultiTenancy;
|
||||
|
||||
namespace Volo.Abp.Authorization.Permissions;
|
||||
|
||||
public interface ICanAddChildPermission
|
||||
{
|
||||
PermissionDefinition AddPermission(
|
||||
[NotNull] string name,
|
||||
ILocalizableString displayName = null,
|
||||
MultiTenancySides multiTenancySide = MultiTenancySides.Both,
|
||||
bool isEnabled = true);
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace Volo.Abp.DependencyInjection;
|
||||
|
||||
[ExposeServices(typeof(IRootServiceProvider))]
|
||||
public class RootServiceProvider : IRootServiceProvider, ISingletonDependency
|
||||
{
|
||||
protected IServiceProvider ServiceProvider { get; }
|
||||
|
||||
public RootServiceProvider(IObjectAccessor<IServiceProvider> objectAccessor)
|
||||
{
|
||||
ServiceProvider = objectAccessor.Value;
|
||||
}
|
||||
|
||||
public virtual object GetService(Type serviceType)
|
||||
{
|
||||
return ServiceProvider.GetService(serviceType);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
namespace Volo.Abp;
|
||||
|
||||
public interface IApplicationNameAccessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the application.
|
||||
/// This is useful for systems with multiple applications, to distinguish
|
||||
/// resources of the applications located together.
|
||||
/// </summary>
|
||||
string ApplicationName { get; }
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace Volo.Abp.SimpleStateChecking;
|
||||
|
||||
public interface ISimpleStateCheckerSerializer
|
||||
{
|
||||
public string Serialize<TState>(ISimpleStateChecker<TState> checker)
|
||||
where TState : IHasSimpleStateCheckers<TState>;
|
||||
|
||||
public ISimpleStateChecker<TState> Deserialize<TState>(JsonObject jsonObject, TState state)
|
||||
where TState : IHasSimpleStateCheckers<TState>;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
using System.Text.Json.Nodes;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Volo.Abp.SimpleStateChecking;
|
||||
|
||||
public interface ISimpleStateCheckerSerializerContributor
|
||||
{
|
||||
[CanBeNull]
|
||||
public string SerializeToJson<TState>(ISimpleStateChecker<TState> checker)
|
||||
where TState : IHasSimpleStateCheckers<TState>;
|
||||
|
||||
[CanBeNull]
|
||||
public ISimpleStateChecker<TState> Deserialize<TState>(JsonObject jsonObject, TState state)
|
||||
where TState : IHasSimpleStateCheckers<TState>;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Nodes;
|
||||
using JetBrains.Annotations;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace Volo.Abp.SimpleStateChecking;
|
||||
|
||||
public class SimpleStateCheckerSerializer :
|
||||
ISimpleStateCheckerSerializer,
|
||||
ISingletonDependency
|
||||
{
|
||||
private readonly IEnumerable<ISimpleStateCheckerSerializerContributor> _contributors;
|
||||
|
||||
public SimpleStateCheckerSerializer(IEnumerable<ISimpleStateCheckerSerializerContributor> contributors)
|
||||
{
|
||||
_contributors = contributors;
|
||||
}
|
||||
|
||||
[CanBeNull]
|
||||
public string Serialize<TState>(ISimpleStateChecker<TState> checker)
|
||||
where TState : IHasSimpleStateCheckers<TState>
|
||||
{
|
||||
foreach (var contributor in _contributors)
|
||||
{
|
||||
var result = contributor.SerializeToJson(checker);
|
||||
if (result != null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
[CanBeNull]
|
||||
public ISimpleStateChecker<TState> Deserialize<TState>(JsonObject jsonObject, TState state)
|
||||
where TState : IHasSimpleStateCheckers<TState>
|
||||
{
|
||||
foreach (var contributor in _contributors)
|
||||
{
|
||||
var result = contributor.Deserialize(jsonObject, state);
|
||||
if (result != null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace Volo.Abp.SimpleStateChecking;
|
||||
|
||||
public static class SimpleStateCheckerSerializerExtensions
|
||||
{
|
||||
public static string Serialize<TState>(
|
||||
this ISimpleStateCheckerSerializer serializer,
|
||||
IList<ISimpleStateChecker<TState>> stateCheckers)
|
||||
where TState : IHasSimpleStateCheckers<TState>
|
||||
{
|
||||
switch (stateCheckers.Count)
|
||||
{
|
||||
case 0:
|
||||
return null;
|
||||
case 1:
|
||||
var serializedChecker = serializer.Serialize(stateCheckers.Single());
|
||||
return serializedChecker != null
|
||||
? $"[{serializedChecker}]"
|
||||
: null;
|
||||
default:
|
||||
var serializedCheckers = new List<string>(stateCheckers.Count);
|
||||
|
||||
foreach (var stateChecker in stateCheckers)
|
||||
{
|
||||
var serialized = serializer.Serialize(stateChecker);
|
||||
if (serialized != null)
|
||||
{
|
||||
serializedCheckers.Add(serialized);
|
||||
}
|
||||
}
|
||||
|
||||
return serializedCheckers.Any()
|
||||
? $"[{serializedCheckers.JoinAsString(",")}]"
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ISimpleStateChecker<TState>[] DeserializeArray<TState>(
|
||||
this ISimpleStateCheckerSerializer serializer,
|
||||
string value,
|
||||
TState state)
|
||||
where TState : IHasSimpleStateCheckers<TState>
|
||||
{
|
||||
if (value.IsNullOrWhiteSpace())
|
||||
{
|
||||
return Array.Empty<ISimpleStateChecker<TState>>();
|
||||
}
|
||||
|
||||
var array = JsonNode.Parse(value) as JsonArray;
|
||||
if (array == null || array.Count == 0)
|
||||
{
|
||||
return Array.Empty<ISimpleStateChecker<TState>>();
|
||||
}
|
||||
|
||||
if (array.Count == 1)
|
||||
{
|
||||
var jsonObject = array[0] as JsonObject;
|
||||
if (jsonObject == null)
|
||||
{
|
||||
throw new AbpException("JSON value is not an array of objects: " + value);
|
||||
}
|
||||
|
||||
var checker = serializer.Deserialize(jsonObject, state);
|
||||
if (checker == null)
|
||||
{
|
||||
return Array.Empty<ISimpleStateChecker<TState>>();
|
||||
}
|
||||
|
||||
return new[] { checker };
|
||||
}
|
||||
|
||||
var checkers = new List<ISimpleStateChecker<TState>>();
|
||||
|
||||
for (var i = 0; i < array.Count; i++)
|
||||
{
|
||||
if (array[i] is not JsonObject jsonObject)
|
||||
{
|
||||
throw new AbpException("JSON value is not an array of objects: " + value);
|
||||
}
|
||||
|
||||
checkers.Add(serializer.Deserialize(jsonObject, state));
|
||||
}
|
||||
|
||||
return checkers.Where(x => x != null).ToArray();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\..\configureawait.props" />
|
||||
<Import Project="..\..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Volo.Abp.Json\Volo.Abp.Json.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapr.Client" Version="1.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\..\configureawait.props" />
|
||||
<Import Project="..\..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Volo.Abp.Dapr\Volo.Abp.Dapr.csproj" />
|
||||
<ProjectReference Include="..\Volo.Abp.DistributedLocking.Abstractions\Volo.Abp.DistributedLocking.Abstractions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||