首页 \ 问答 \ 获取所有B2B目录用户是其成员(Getting all B2B directories user is member of)

获取所有B2B目录用户是其成员(Getting all B2B directories user is member of)

由于我们在GA中拥有Azure AD的B2B功能,因此我很好奇如何在多租户应用程序中使用B2B。 更具体地说,如何获取用户所属目录的列表? 例如,Azure门户通过调用https://portal.azure.com/AzureHubs/api/tenants/List执行此操作,Microsoft的My Apps调用https://account.activedirectory.windowsazure.com/responsive/multidirectoryinfo以获取信息 - 是否有公共端点?

用例是在多租户应用程序中启用B2B合作,该应用程序在每个用户的目录中提供,以便它们拥有自己的实例,但无法集中提取有关用户目录的信息。

一个简单的解决方法是查询所有为用户的UPN配置应用程序的租户,如果找到,将其显示在列表中,但想象一下是否有数百个租户...我相信这对于应用程序开发人员来说非常重要希望在多租户应用程序中利用B2B功能。

更新:似乎有一种方法可以通过访问Azure服务管理API来执行此操作,但是此API和方法未记录,我想如果发生任何问题,Microsoft会说它不是受支持的方案。

更新2:我写了一篇关于整个设置的文章,包括如何在场景中使用它的示例项目,可以在这里找到https://hajekj.net/2017/07/24/creating-a-多租户-应用-其中-载体-B2B用户/


Since we have Azure AD's B2B feature in GA, I am curious how to make use of B2B in multi-tenant applications. More specifically, how to get a list of directories which the user is member of? For example, the Azure Portal does this by calling https://portal.azure.com/AzureHubs/api/tenants/List, Microsoft's My Apps calls https://account.activedirectory.windowsazure.com/responsive/multidirectoryinfo to get the information - is there a public endpoint for this?

The use case is to enable B2B cooperation across a multi-tenant application which is provisioned in each user's directory so they have their own instances, but there is no way to centrally pull the information about user's directories.

A simple workaround would be to query all tenants which have the application provisioned for the user's UPN and if found, display it in the list, but imagine if there were hundreds of tenants... I believe that this is quite crucial for app developers who want to leverage the B2B functions in multi-tenant applications.

Update: It seems like there is a way to do this by accessing the Azure Service Management API, however this API and method is undocumented and I suppose that if any issues would occur, Microsoft would say that it is not a supported scenario.

Update 2: I wrote an article about the whole setup, including a sample project of how to make use of this in a scenario, it can be found here https://hajekj.net/2017/07/24/creating-a-multi-tenant-application-which-supports-b2b-users/


原文:https://stackoverflow.com/questions/45235572
更新时间:2022-07-19 09:07

最满意答案

更改

<?php echo form_open('shop/add', 'id="form"'); ?>

<?php echo form_open('shop/add', 'id="form_' . $id . '"'); ?>

这为每个表单提供了不同的id。


I tried many ways of dealing with this and finally the thing that worked for me was as under:

<script type = "text/javascript">
    $('.submit').click(function(){
        var id = (this.id);
        var form_data = {            //repair
            id: id,
            name: $('#name_' + id).val(),
            rate: $('#rate_' + id).val(),
            qty: $('#qty_' + id).val()
        };

    $.ajax({
        url: "<?php echo site_url('shop/add'); ?>",//repair
        type: 'POST',
        data: form_data, // $(this).serialize(); you can use this too
        success: function(msg) {
              alert("success..!! or any stupid msg");
        }

   });
   return false;

});

</script>

相关问答

更多
  • 您不需要使用JSON.parse ,变量数据已经是JSON,因此只需将其用作任何其他JSON。 You don't need to use JSON.parse the variable data is already a JSON, so just use it as a you would with any other JSON.
  • 更改 这为每个表单提供了不同的id。 I tried many ways of dealing with this and finally the thing that worked for me was as under: