Skip to content

Commit 8afbe45

Browse files
committed
Skip insert permissions if the permissions are empty.
1 parent cf10d78 commit 8afbe45

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)