Skip to content

Default roles on registration - #2753

Merged
hikalkan merged 4 commits into
devfrom
Default-roles-on-registration
Feb 5, 2020
Merged

Default roles on registration#2753
hikalkan merged 4 commits into
devfrom
Default-roles-on-registration

Conversation

@yekalkan

@yekalkan yekalkan commented Feb 4, 2020

Copy link
Copy Markdown
Member

resolves #2721


public virtual async Task<List<IdentityRole>> GetDefaultOnesAsync(CancellationToken cancellationToken = default)
{
return await DbSet.Where(r => r.IsDefault).ToListAsync(cancellationToken: cancellationToken);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use GetCancellationToken(cancellationToken) just as like other methods.


public virtual async Task<List<IdentityRole>> GetDefaultOnesAsync(CancellationToken cancellationToken = default)
{
return await GetMongoQueryable().Where(r => r.IsDefault).ToListAsync(cancellationToken: cancellationToken);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use GetCancellationToken(cancellationToken) just as like other methods.

);

Task<List<IdentityRole>> GetDefaultOnesAsync(
CancellationToken cancellationToken = default

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add bool includeDetails = false parameter to be compatible to other methods. See https://docs.abp.io/en/abp/latest/Best-Practices/Repositories to learn the rules. The section below explains this rule:

image

public virtual async Task<List<IdentityRole>> GetDefaultOnesAsync(
bool includeDetails = false, CancellationToken cancellationToken = default)
{
return await DbSet.Where(r => r.IsDefault).ToListAsync(GetCancellationToken(cancellationToken));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the implementation of the includeDetails?

@hikalkan
hikalkan merged commit f6d1296 into dev Feb 5, 2020
@hikalkan

hikalkan commented Feb 5, 2020

Copy link
Copy Markdown
Member

@cotur can you test this feature in the application startup template?

@hikalkan
hikalkan deleted the Default-roles-on-registration branch February 6, 2020 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Property IsDefault of entity IdentityRole not implemented

2 participants