1.I created a new project ( MVC - EF - 4.2.2)
On build I see error in d:\abptest2\src\Test.Domain.Shared\TestDomainSharedModule.cs(38,23): error CS0246: The type or namespace name "AbpIdentityProDomainSharedModule" could not be found (are you missing a using directive or an assembly reference?)[d:\abptest2\src\Test.Domain.Shared\Test.Domain.Shared.csproj]
I would like to define Permissions:
public static class WorkAppPermissions
{
public const string GroupName = "WorkApp";
public static class Dashboard
{
public const string DashboardGroup = GroupName + ".Dashboard";
public const string Host = DashboardGroup + ".Host";
public const string Tenant = DashboardGroup + ".Tenant";
}
//Add your own permission names. Example:
//public const string MyPermission1 = GroupName + ".MyPermission1";
public class WorkLogs
{
public const string Default = GroupName + ".WorkLogs";
public const string Edit = Default + ".Edit";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class WorkLogsPowerAdmin
{
public const string Default = GroupName + ".WorkLogs";
public const string Edit = Default + ".Edit";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
}
To be able to use them when configuring the system in Identity Management -> Roles -> Permissions. Your solution severely limits configuration flexibility. In the domain layer, It should refer to Permissions, Roles should be remained flexible. Therefore, I would like to know how to handle this case in endpoint.
If requester is an admin, get all the data from db; if a user, get only data that the user has created.
Exacly, this is what I want to do.
I would like to give the entry owner permissions and the same permissions for all records to the administrator. In the code I want to include filter if LogPowerAdmin show all, if WorkLogs show only current user resources. Is this the right way?
I added code to the test app (new clean app generated by apb suite).
I get an error:
System.InvalidOperationException: Nullable object must have a value. at System.Nullable`1.get_Value() at Volo.Abp.Users.CurrentUserExtensions.GetId(ICurrentUser currentUser) at TestApp.Web.PageFilters.UserInfoCheckPageFilter.OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, PageHandlerExecutionDelegate next) in D:\dotnet\testapp\src\TestApp.Web\PageFilters\UserInfoCheckPageFilter.cs:line 37 at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<b__1>d.MoveNext()
--- End of stack trace from previous location --- at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService) at IdentityServer4.Hosting.MutualTlsEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<b__1>d.MoveNext()
--- End of stack trace from previous location --- at Microsoft.AspNetCore.Builder.ApplicationBuilderAbpJwtTokenMiddlewareExtension.<>c__DisplayClass0_0.<b__0>d.MoveNext()
--- End of stack trace from previous location --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<b__1>d.MoveNext()
--- End of stack trace from previous location --- at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)