HI @ismcagdas,
From what I can tell this is failing.
if (_roleManager.IsGranted(roleId, permission))
{
return true;
}
Even though the role does have permissions to the permission this fails. Another piece of info is that I'm using a centralised Redis cache for my caching. When I check the Redis cache I see no entry for the newly created role in the AbpZeroRolePermissions cache key.
I do see an entry in the AbpZeroUserPermissions cache key however. So it looks like when the tenant is being created the role that is just created for the new admin user does not have its permissions cached at the time the SubscribeToAllAvailableNotificationsAsync call is made.
Thanks Rick
Hi @ismcagdas,
parentPermission.CreateChildPermission(AppPermissions.Pages_Operations_My_Permission_View, L("MyPermission"), featureDependency: new SimpleFeatureDependency(AppFeatures.OneOfMyAppFeaturesFeature), multiTenancySides: MultiTenancySides.Tenant, properties: forUserRoleProperties);
forUserRoleProperties is my own special property I attach to some permissions
it is defined as var forUserRoleProperties = new Dictionary<string, object>() { { "ForUserRole", true } };
The permission itself is a child of this parent permission var parentPermission = pages.CreateChildPermission(AppPermissions.Pages_Operations, L("Operations"), multiTenancySides: MultiTenancySides.Tenant, properties: forUserAndGuestRoleProperties);
This is the only instance I've seen where something strange like this happens. Everwhere else the permissions are rock solid.
Thanks Rick
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
I have a notification defined as follows (simplified)
context.Manager.Add(
new NotificationDefinition(
AppNotificationNames.MyNotification,
displayName: L("MyNotification"),
permissionDependency: new SimplePermissionDependency(AppPermissions.Pages_Operations_My_Permission_View)
)
);
What I have found is that the following line in TenantManager:193 await _notificationSubscriptionManager.SubscribeToAllAvailableNotificationsAsync(new UserIdentifier(newTenantId, newAdminId));
Does not actually subscribe to all notifications. It would seem that it only subscribes to notifications that the host account user that is creating the tenant (with admin) also has access to. I have many other notifications defined in the AppNotificationProvider.cs that both the host account has access too and the new admin will also have access to based on permission dependencies and these are added without a problem (Eg: NewUserRegisteredNotificationDefinition).
However in this particular case the host account user does not have access too AppPermissions.Pages_Operations_My_Permission_View and as such it would appear as though the new tenant admin doesn't automatically get subscribed to this notification.
I've gone through the code for the SubscribeToAllAvailableNotificationsAsync and cannot manage to see why this is happening.
Need some help please. Thanks Rick
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
AccountAppService.cs:166
This GetUserByIdAsync will throw an exception if the userID is not found. The code after it checks for user!=null and user ==null which would never happen and thus the user gets an UnFriendlyException message.
I change my code to
var user = await UserManager.Users.FirstOrDefaultAsync(u => u.Id == input.UserId);
to get ensure we could get a null user.
PS: I'm not sure how my user actually got this error, but we had a case where someone was trying to activate with userid = 0 which threw this exception. We're still investigating that.
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
Hey Team,
Just trying to work out how the authentication to the public website works. Does it share the same login information as with the Angular site. Eg: If I'm already logged into the angular site and I navigate over to the public site will they share the same login information (assuming they run under the same base domain eg: app.mysite.com www.mysite.com
Was hoping the cookies from the app.mysite.com would mean that you're already automatically logged in to the public site.
It would seem however that this may not be the case and some returnurl magic happens?
Thanks Rick
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
https://github.com/aspnetzero/aspnet-zero-core/blob/dev/angular/src/app/admin/webhook-subscription/create-or-edit-webhook-subscription-modal.component.ts#L82 should be
this.webhookSubscription.webhooks = this.webhooks.map(wh => wh.value);
instead of this.webhookSubscription.webhooks = this.webhooks.map(wh => wh.name);
If you specify a display name which is friendly and not the same as the value in the Webhook Definition then you won't be able to create them without changing the line above.
Thanks Rick
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
When using the maintenance screens to clear all cache or any individual cache you get the below exception. Also looking at the code here https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore.PerRequestRedisCache/Runtime/Caching/Redis/AbpPerRequestRedisCache.cs
It doesn't appear as though the redis cache is cleared at all. It just looks to clear the HttpContext per reqeust cache.
Ideally it should be doing both I would think?
ERROR 2021-06-23 13:57:44,733 [33 ] Mvc.ExceptionHandling.AbpExceptionFilter - Unable to cast object of type 'System.Object' to type 'System.String'. System.InvalidCastException: Unable to cast object of type 'System.Object' to type 'System.String'. at Abp.Runtime.Caching.Redis.AbpPerRequestRedisCache.Clear() at Abp.Runtime.Caching.AbpCacheBase.ClearAsync() at Inbound.Caching.CachingAppService.ClearAllCaches() in C:\Source\Inbound\aspnet-core\src\Inbound.Application\Caching\CachingAppService.cs:line 44 at lambda_method6307(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
Thanks Ismcagdas,
Didn't realise it was it's own nuget. Added it in and all good on that front now.
Thanks
As per the release notes here https://github.com/aspnetboilerplate/aspnetboilerplate/releases/tag/v6.1.0
It would suggest that this issue is resolved and available in 6.1.0 https://github.com/aspnetboilerplate/aspnetboilerplate/pull/5910
However. Per that pull request it was only ever merged into Dev and it does not look like the AbpPerRequestRedisCache is available in 6.1.0 or 6.3.0 which is the version I'm currently using.
We're currently having a lot of issues with Redis which we hope this will resolve.
Are you able to advise what the plans are here?
Thanks