Skip to content

Commit 1d8fc5b

Browse files
Merge pull request #21453 from abpframework/mazarkaman-patch
Skip insert `permissions` if the `permissions` are empty.
2 parents cf10d78 + 8afbe45 commit 1d8fc5b

File tree

1 file changed

+4
-0
lines changed
  • modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement

1 file changed

+4
-0
lines changed

modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeeder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public virtual async Task SeedAsync(
3636
var names = grantedPermissions.ToArray();
3737
var existsPermissionGrants = (await PermissionGrantRepository.GetListAsync(names, providerName, providerKey)).Select(x => x.Name).ToList();
3838
var permissions = names.Except(existsPermissionGrants).Select(permissionName => new PermissionGrant(GuidGenerator.Create(), permissionName, providerName, providerKey, tenantId)).ToList();
39+
if (!permissions.Any())
40+
{
41+
return;
42+
}
3943
await PermissionGrantRepository.InsertManyAsync(permissions);
4044
}
4145
}

0 commit comments

Comments
 (0)