Starts in:
0 DAY
17 HRS
20 MIN
29 SEC
Starts in:
0 D
17 H
20 M
29 S

Activities of "alexander.nikonov"

Ok, I will try. But we don't use Redis: we use ABP cache in each app and sync them via RabbitMQ. Does it make the difference?

Probably you mean I might create a test ABP solution using ABP Suite setting it up for free SQL Server Express version - then add custom Permission Definition provider stuff, then add the UI page in test Angular app for creating custom permission definitions + assigning definitions to a user role, after this - add the API method for "refreshing" permission definition and finally check if the assignment is successful.

Even if it sounds simple for you - it does not sound simple for me. Our project has been developing during 3 years, becoming more and more complex and customized. Unfortunately, we do not have dedicated time to create custom projects for resolving occured issues. The preparation stage to accomplish all this in test ABP solution seems to take a noticeable amount of time. Plus - even if everything would work out here - it would make little sense for us, since it would mean the problem is somewhere else: for instance, we use a separate host (let's call it "host X") which consumes Domain.Shared and Application.Contracts projects from other hosts (A, B, C). When I create a permission definition - i make API call to this host from host A (it is like an admin host). Then I use RabbitMQ queries to refresh ABP Permission cache in ALL hosts (A, B, C). When I want to assign the created permission definition - I also make API call from host A to host X... So, now until I restart host X - I cannot make this assignment. Probably the problem is actually in this.

I would prefer try to identify the problem in our site (by debugging, etc.) - step by step. Just let me know where do I need to look and what do I need to look (probably debug PermissionAppService or whatever).

One more note which maybe is useful, maybe not: the custom permission definition I'm trying to assign is also a role at the same time (we have two-layer role mechanism): So we actually assign a "module role" to an "ordinary role". But it should not be a problem I guess, because there is a custom Permission Definition Provider which just reads "module roles" as usual permissions from DB... Later on we assign "ordinary permissions" to "module roles".

Everything works fine in this implementation. The only issue is that I need to restart host X to be able to assign "module roles" to "ordinary roles" (user roles).

I don't think it's feasible unfortunately. Our project is commercial and highly customized... Besides, it uses Oracle DB. It would take ages to create a test project based on it.

Could you please take the method above as a reference instead, wrap it inside API and try calling it from some test Angular app after creating a permission definition from UI in this test app? After calling this method - as we suppose here - I should be able to assign the brand-new permission definition to a user role using ABP PermissionService (as also shown in the code above) without restarting the host...

No, i did not insert them manually. I used the code shown previously:

So, after this code I manually run server API request from client which executes the following:

    public virtual async Task RefreshAbpPermissionsAsync()
    {
        if (_cancellationTokenProvider.Token.IsCancellationRequested)
        {
            return;
        }

        if (_permissionManagementOptions.Value.SaveStaticPermissionsToDatabase)
        {
            await Policy
                .Handle<Exception>()
                .WaitAndRetryAsync(8, retryAttempt => TimeSpan.FromSeconds(RandomHelper.GetRandom((int)Math.Pow(2, retryAttempt) * 8, (int)Math.Pow(2, retryAttempt) * 12)))
                .ExecuteAsync(async _ => await _staticPermissionSaver.SaveAsync(), _cancellationTokenProvider.Token);
        }

        if (_cancellationTokenProvider.Token.IsCancellationRequested)
        {
            return;
        }

        if (_permissionManagementOptions.Value.IsDynamicPermissionStoreEnabled)
        {
            await _dynamicPermissionDefinitionStore.GetGroupsAsync();
        }
    }

This code is successful, as well as StaticPermissionSavermethod RunAsync. So I see no reasons why the permission assignment afterwards is unsuccessful. No clue.

currentHash is changed. hasChangesInPermissions is true (hasChangesInGroups is false). All in all, the method SaveAsync works as expected, no catch triggered... However the permissions are not assigned...

Done. The created permissions are present in permissionRecords collection:

Despite this fact, when I try to assign them - the assignment is ignored until I restart the app:

Since I'm doing this from AppService not AbpModule as in the original code, I've simplified the code. I took the DI instances of some required services and used the code below (_dynamicPermissionDefinitionStore is not needed at all I think, because we do not use dynamic permissions, anyway, it makes no difference):

    private async Task RefreshAbpStaticAndDynamicPermissionsAsync()
    {
        await Policy
            .Handle<Exception>()
            .WaitAndRetryAsync(8, retryAttempt => TimeSpan.FromSeconds(RandomHelper.GetRandom((int)Math.Pow(2, retryAttempt) * 8, (int)Math.Pow(2, retryAttempt) * 12)))
            .ExecuteAsync(async _ => await _staticPermissionSaver.SaveAsync(), _cancellationTokenProvider.Token);

        await _dynamicPermissionDefinitionStore.GetGroupsAsync();
    }

However, it still does not work.

Do you have any further suggestions?

@maliming so basically I need to sequentially call SaveStaticPermissionsToDatabaseAsync and then - PreCacheDynamicPermissionsAsync?

Not resolved yet

I found out, that the following routing was somehow lost:

  {
    path: 'identity-server',
    loadChildren: () => import('@volo/abp.ng.identity-server').then(m => m.IdentityServerModule.forLazy()),
  },

Please, regain my points.

Showing 121 to 130 of 289 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06