abpframework / abp

Open Source Web Application Framework for ASP.NET Core. Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET and the ASP.NET Core platforms. Provides the fundamental infrastructure, production-ready startup templates, application modules, UI themes, tooling, guides and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.31k stars 3.32k forks source link

#1666 organization units #2563

Closed mperk closed 3 years ago

mperk commented 4 years ago

Resolve #1666 Everything is done. If you can find a bug please send me. I want to fix. I found a bug but I can't fix. I don't know why. I want to your help with this. You can see the bug: OrganizationUnitManager_Tests => AddRoleToOrganizationUnitAsync

hikalkan commented 4 years ago

Thank you @mperk I will review this. @maliming can you also review it before me? Thanks.

maliming commented 4 years ago

hi @mperk According to the current design, how do I get its users based on an ou id in the application service layer?

mperk commented 4 years ago

hi @mperk According to the current design, how do I get its users based on an ou id in the application service layer?

hi @maliming I think I missed it. I will commit it as soon as. Thank you.

maliming commented 4 years ago
class IdentityOrganizationUnit : AggregateRoot<Guid>
{

}

class IdentityUserOrganizationUnit : Entity
{
    Guid UserId

    Guid OrganizationUnitId
}

class IdentityRoleOrganizationUnit : Entity
{
    Guid RoleId

    Guid OrganizationUnitId
}

class IdentityUser : AggregateRoot<Guid>
{
    ICollection<IdentityUserOrganizationUnit> OrganizationUnits
}

class IdentityRole : AggregateRoot<Guid>
{
    ICollection<IdentityRoleOrganizationUnit> OrganizationUnits
}

IOrganizationUnitRepositoryis used to get its structure, users, roles. (Getusers. Getroles)

IdentityUserManagerand IdentityRoleManageris used to manage the organization of users and roles. (AddToOrg. RemoveOrg getOrgList ..)

We can use IOrganizationUnitRepositoryin IdentityUserStoreto get the role information of the user organization.

I'm not sure if we should merge OrganizationUnitManagerinto IOrganizationUnitRepository, because its methods all seem to be crud operations.

This is my simple idea, what do you think?

mperk commented 4 years ago
class IdentityOrganizationUnit : AggregateRoot<Guid>
{

}

class IdentityUserOrganizationUnit : Entity
{
  Guid UserId

  Guid OrganizationUnitId
}

class IdentityRoleOrganizationUnit : Entity
{
  Guid RoleId

  Guid OrganizationUnitId
}

class IdentityUser : AggregateRoot<Guid>
{
  ICollection<IdentityUserOrganizationUnit> OrganizationUnits
}

class IdentityRole : AggregateRoot<Guid>
{
  ICollection<IdentityRoleOrganizationUnit> OrganizationUnits
}

IOrganizationUnitRepositoryis used to get its structure, users, roles. (Getusers. Getroles)

IdentityUserManagerand IdentityRoleManageris used to manage the organization of users and roles. (AddToOrg. RemoveOrg getOrgList ..)

We can use IOrganizationUnitRepositoryin IdentityUserStoreto get the role information of the user organization.

I'm not sure if we should merge OrganizationUnitManagerinto IOrganizationUnitRepository, because its methods all seem to be crud operations.

This is my simple idea, what do you think?

Me too, I am not sure but I think it should be seperate.

crashsol commented 4 years ago

In many cases, customers need to sort the organization by themselves. It is perfect to provide a sorting field in the basic module, public float sorting {get; set;}

Floating point can be easily sorted by dragging in the front end

Nokecy commented 4 years ago

any update?

hikalkan commented 4 years ago

I will deeply review this (probably) tomorrow.

hikalkan commented 4 years ago

Hi all,

Thank you @mperk for your great contribution. As overall, it is really fine. However, I found some problems with the implementation. Some of them are minor, some of them are related to design decisions, but some of them are bugs (for example, OrganizationUnit should not have a Children property which violates the aggregate rule: reference other aggregates only by id. We should remove this collection, otherwise it fails when we want to insert this entity to a document database like MongoDB).

So, I moved this to v2.2 milestone (we'll release v2.1 today), will review deeper and write my comments in details.

hikalkan commented 4 years ago

BTW, @mperk, it would be appreciated if you solve the conflicts.

mperk commented 4 years ago

BTW, @mperk, it would be appreciated if you solve the conflicts.

I did it.

vd3d commented 4 years ago

Hi,

No news about this merge ? :-P

or is it for later (when ? next month ... ) ?

Thanks

maliming commented 4 years ago

@vd3d It is planned in abp 2.2. March 05, 2020.

hikalkan commented 4 years ago

Thank you again @mperk for your great contribution. I checked it deeply and found some points to improve. However, I will handle them, finalize the feature and merge it in the v2.3 (sorry to move to to v2.3, but we need it). So, you don't need to make addinional commits.

Here, a list of my findings (notes for myself 🙂):

maliming commented 4 years ago

will it delay again?

If you are eager for this feature, you can implement it yourself.

viewtance commented 4 years ago

Look forward to see this feature early, thank you guys.

hikalkan commented 4 years ago

We are actively working on this. Hopefully it will be released with the v2.6 (April 20th planned date).

xewn commented 4 years ago

When is the Organization units for the Identity module released?

hikalkan commented 3 years ago

Hopefully with this (2.8) release if we don't have any significiant problem. Still working on it.

hikalkan commented 3 years ago

Hi all,

Unfortunately, we won't be able to release this with v2.8. It is "almost" finished, but not well tested. This is a core feature (effects roles & permissions) and releasing it tomorrow (the release day) will be risky.

It will be definitely released with v2.9 (2 weeks later), sorry for the delay.

mgochmuradov commented 3 years ago

Hi @hikalkan! Is there any documentation on how to use this feature? Or could you please give a short instruction on how to get started with this.

maliming commented 3 years ago

hi @mgochmuradov You can temporarily refer to the explanation of aspnetboilerplate for this. https://aspnetboilerplate.com/Pages/Documents/Zero/Organization-Units

hikalkan commented 3 years ago

Will be documented here: https://docs.abp.io/en/abp/latest/Modules/Identity