Activities of "liangshiwei"

We will enhance it in the next version

I use your site key and site secret, and it also works.

I think it is more related to your local environment. can we have a meeting? I'd like to check it remotely. shiwei.liang@volosoft.com

Hi,

Try await serviceScope.ServiceProvider.GetRequiredService<MRSDbMigrationService>().MigrateAsync();

HI,

It has nothing to do with the theme, and lepton theme also works for me.

I think you are specifying the wrong version.

I could reproduce the problem if I specify version 3 but use version 2 site key and site secret

Hi,

It's working for me.

Site key: 6LetWMwZAAAAABU_tYdnlB54yJx-06FsWqfc27Ee Site secret 6LetWMwZAAAAAEMvn9TxKHcji45_ZM7TFGXMHO2q

Hi,

You need to use the data seeding system to initial data: https://docs.abp.io/en/abp/latest/Data-Seeding

Hi,

I will check it

Hi,

Yes, it's possible, but it has a lot of work to do and breaks the existing framework design.

MyRolePermissionManagementProvider

[ExposeServices(typeof(RolePermissionManagementProvider))]
public class MyRolePermissionManagementProvider : RolePermissionManagementProvider
{
    public MyRolePermissionManagementProvider(
        IPermissionGrantRepository permissionGrantRepository,
        IGuidGenerator guidGenerator,
        ICurrentTenant currentTenant,
        IUserRoleFinder userRoleFinder) : base(permissionGrantRepository, guidGenerator, currentTenant, userRoleFinder)
    {
    }

    public override async Task<MultiplePermissionValueProviderGrantInfo> CheckAsync(string[] names, string providerName, string providerKey)
    {
        var multiplePermissionValueProviderGrantInfo = await base.CheckAsync(names, providerName, providerKey);
        if (providerName != UserPermissionValueProvider.ProviderName)
        {
            return multiplePermissionValueProviderGrantInfo;
        }

        var permissionNotGrants = await PermissionGrantRepository.GetListAsync(names, providerName, $"{providerKey},False");


        foreach (var permissionNotGrant in permissionNotGrants)
        {
            if (multiplePermissionValueProviderGrantInfo.Result.ContainsKey(permissionNotGrant.Name))
            {
                multiplePermissionValueProviderGrantInfo.Result[permissionNotGrant.Name] = new PermissionValueProviderGrantInfo(false, providerKey);
            }
        }

        return multiplePermissionValueProviderGrantInfo;
    }
}

It will check the user permissions again and change the result if the permission is not granted to the user.

MyUserPermissionManagementProvider

[ExposeServices(typeof(UserPermissionManagementProvider))]
public class MyUserPermissionManagementProvider : UserPermissionManagementProvider
{
    protected IUserRoleFinder UserRoleFinder { get; }

    public MyUserPermissionManagementProvider(IPermissionGrantRepository permissionGrantRepository, IGuidGenerator guidGenerator, ICurrentTenant currentTenant, IUserRoleFinder userRoleFinder) : base(permissionGrantRepository, guidGenerator, currentTenant)
    {
        UserRoleFinder = userRoleFinder;
    }

    public override Task<MultiplePermissionValueProviderGrantInfo> CheckAsync(string[] names, string providerName, string providerKey)
    {
        var key = $"{providerKey},True";
        return base.CheckAsync(names, providerName, key);
    }

    public override async Task SetAsync(string name, string providerKey, bool isGranted)
    {
        if (isGranted)
        {
            await RevokeAsync(name, $"{providerKey},False");
            if(await ShouldAddPermissionAsync(name, providerKey))
            {
                await AddIfNotExistsAsync(name, providerKey, isGranted);
            }

            return;
        }


        await RevokeAsync(name, $"{providerKey},True");
        await AddIfNotExistsAsync(name, providerKey, isGranted);
    }

    private async Task<bool> ShouldAddPermissionAsync(string name, string providerKey)
    {
        var userId = Guid.Parse(providerKey);
        var roleNames = await UserRoleFinder.GetRolesAsync(userId);

        foreach (var roleName in roleNames)
        {
            var permission = await PermissionGrantRepository.FindAsync(name,RolePermissionValueProvider.ProviderName, roleName);
            if(permission != null)
            {
                return false;
            }
        }

        return true;
    }

    private async Task AddIfNotExistsAsync(string name, string providerKey, bool isGranted)
    {
        var key = $"{providerKey},{isGranted}";

        if (await PermissionGrantRepository.FindAsync(name, Name, key) != null)
        {
            return;
        }

        await PermissionGrantRepository.InsertAsync(
            new PermissionGrant(
                GuidGenerator.Create(),
                name,
                Name,
                key,
                CurrentTenant.Id
            )
        );
    }
}

It will add suffixes True and False to the provider key.

It should work for you, but I didn't consider all scenarios. you should do the full test to check it and enhance it

Hi,

Please add these module dependencies to MRSModule

// Saas Management module packages
typeof(SaasHostWebModule),
typeof(SaasHostHttpApiModule),
typeof(SaasHostApplicationModule),
typeof(SaasEntityFrameworkCoreModule)

BTW, I guess you don't want to include the SaasModule in your project. if so, you don't need to add module dependencies. but you should remove all ITenantRepository uses.

Update the MRSDbMigrationService class.

public class MRSDbMigrationService : ITransientDependency
{
    public ILogger<MRSDbMigrationService> Logger { get; set; }

    private readonly IDataSeeder _dataSeeder;
    private readonly MRSEFCoreDbSchemaMigrator _dbSchemaMigrator;

    public MRSDbMigrationService(
        IDataSeeder dataSeeder,
        MRSEFCoreDbSchemaMigrator dbSchemaMigrator)
    {
        _dataSeeder = dataSeeder;
        _dbSchemaMigrator = dbSchemaMigrator;

        Logger = NullLogger<MRSDbMigrationService>.Instance;
    }

    public async Task MigrateAsync()
    {
        var initialMigrationAdded = AddInitialMigrationIfNotExist();

        if (initialMigrationAdded)
        {
            return;
        }

        Logger.LogInformation("Started database migrations...");

        await MigrateDatabaseSchemaAsync();
        await SeedDataAsync();

        Logger.LogInformation($"Successfully completed host database migrations.");

        Logger.LogInformation("You can safely end this process...");
    }
    
    .........
 }

Add the following code to Program class

if (IsMigrateDatabase(args))
{
    builder.Services.AddDataMigrationEnvironment();
}

Hi,

It's better you create different roles to manage the permissions. https://en.wikipedia.org/wiki/Role-based_access_control Or you can set a role without any permission and manage the permissions on the user side.

Showing 4491 to 4500 of 6693 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on November 07, 2025, 08:20