microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
924 stars 287 forks source link

Organizational Chart for Active Directory Organization Units or Groups with Hierarchy #1425

Closed brucelane closed 2 years ago

brucelane commented 2 years ago

Proposal: Organizational Chart for Active Directory Organization Units

Description

The MGT components are user centric. I'm building an Organizational Chart based on OUs, not people.

Rationale

Coming from an on-premises AD, we have a tenant now, but I can't see the OUs anymore. Maybe I have to create Groups in my tenant to mimick my directory hierarchy?

Preferred Solution

I understand OUs wont be implemented in Azure AD, but can this be achieved with group relationships? Then a set of components showing Groups(standard information and parent/childs) instead of people would be nice. A GroupPicker component too.

Example:

const MgtGroupPicker: React.FC = () => {
  const [group, setGroup] = useState([]);

  const handleSelectionChanged = (e: any) => {
    setGroup(e.target.selectedGroup);
  };
  return (
    <>
<GroupPicker
        selectionChanged={handleSelectionChanged}
      />
Details: <Group group={group} />
    </>

Additional Context

I'm using React and TypeScript

ghost commented 2 years ago

Hello brucelane, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

aaclage commented 2 years ago

Hi @brucelane, base on you request i see this more how the metadata structure is organize and how the Microsoft Graph API will help you retrieve the data and not a MGT component issue, the mgt component will help you will display some key info and keep look & fell as the current components in Office 365 with a lot of nice add-in (template, dark mode style, authorization, SSO, etc). As you said, Azure AD doesn't have OU but you can also use graph query such us "Org hierarchy": https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0 or https://docs.microsoft.com/en-us/graph/api/user-list-directreports?view=graph-rest-1.0&tabs=http

If you are still interested in governance your orgchart by groups then recommend a well defined structure of groups that you fall in infinite loop of groups dependencies :) and some effort on the code to make it work, here the api related with groups: https://docs.microsoft.com/en-us/graph/api/resources/group?view=graph-rest-1.0 and use the same logic

I can also recommend to give a look in other repos, for example the pnp SPFX samples, can give you some guidance: https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-tree-orgchart or https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-organization-chart

PS: i am outsider and don't have the knowledge of MGT team and they can give you better approach's, so take it with a grain of salt my comments upper, just trying to help.

sebastienlevert commented 2 years ago

Thanks for the suggestion @brucelane. Can you go deeper in your issue? I'm wondering here if this is really a new component you are looking for or an ask for Graph to help represent a structured response with all the people in the org. Thanks! If you have just a mockup of what you'd be looking for, please provide it, it will be very helpful!

brucelane commented 2 years ago

Thanks for your replies @aaclage @sebastienlevert !

It's about creating orgcharts for new scenarii, based on templates from the current on-prems AD OUs structure. One could start with a template from any service(OU) in the hierarchy, add nodes. I think I will code a custom REST API for the templates, built from on-premises AD querying.

Then I would need controls for the Groups, not the people. The problem is that groups are not hierarchical in AD. Using Graph, I would have to start from a person, the manager of a OU, find the hierarchy from the ReportsTo field, and find all the children, too complicated...

I could code a custom React component, but a Group/other component would be nice with the following fields: OU/Group name(IT Department), position(Director), manager name(Bruce LANE). Maybe I can adapt the current Person component. change its layout.

sebastienlevert commented 2 years ago

For now, this is not something that we will be working on as it's really about Graph and the structure of your data. I think this can be accomplished with a mgt-get templates and a couple of calls to Graph. For now, I'll be closing this issue but feel free to reopen it if you think this is related to MGT. Thanks!