zoukankan      html  css  js  c++  java
  • 通过API找出Autodesk Vault中某个用户组可以访问的Vault

    首先在Vault Explorer中可以这样查看和更改某个用户组有权访问的vault

    Tools –> Administration –> Global Settings –> Groups… 打开用户组管理对话框, 双击某个组,点“Vaults…” 按钮即可查看和编辑这个组所能访问的vault。

    image

    现在通过API来实现,没啥说的,直接上代码:

    using Autodesk.Connectivity.Explorer.Extensibility;
    using Autodesk.Connectivity.WebServices;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using VDF = Autodesk.DataManagement.Client.Framework;

    namespace HelloWorldVaultExplorer
    {
        public class ListUserGroupVaults : IExplorerExtension
        {
            public IEnumerable<CommandSite> CommandSites()
            {
                CommandItem listGrougVaultsCmdItem = new CommandItem("HelloWorldVaultExplorer.ListUserGroupVaultsCmd",
                                                    "List Group Vaults - Daniel");

                listGrougVaultsCmdItem.Execute += listGrougVaultsItem_Execute;

                CommandSite toolsMenuSite = new CommandSite("ListUserGroupVaultsCmd.Toolbar",
                                                        "List Group Vaults Menu- Daniel");
                toolsMenuSite.Location = CommandSiteLocation.ToolsMenu;
                toolsMenuSite.AddCommand(listGrougVaultsCmdItem);

                List<CommandSite> sites = new List<CommandSite>();
                sites.Add(toolsMenuSite);

                return sites;



            }

            void listGrougVaultsItem_Execute(object sender, CommandItemEventArgs e)
            {

               

                try
                {
                    //using VDF = Autodesk.DataManagement.Client.Framework
                    VDF.Vault.Currency.Connections.Connection connection =
                                    e.Context.Application.Connection;

                    string msg = "";
                    Group[] groups = connection.WebServiceManager.AdminService.GetAllGroups();
                    foreach (var group in groups)
                    {
                        GroupInfo grpInfo = connection.WebServiceManager.AdminService
                                .GetGroupInfoByGroupId(group.Id);
                        msg += grpInfo.Group.Name + " ";

                        msg += "Group accessable vaults : ";
                        if (grpInfo.Vaults == null)
                        {
                            msg += " this group has no accessable vaults. ";
                            continue;
                        }

                        foreach (var vault in grpInfo.Vaults)
                        {
                            msg += vault.Id + ": " + vault.Name + " ";
                        }

                    }

                    MessageBox.Show(msg);



                }
                catch (Exception ex)
                {

                    // If something goes wrong, we don't want the exception to bubble up to Vault Explorer.
                    MessageBox.Show("Error: " + ex.Message);
                }

            }



        }
    }

    结果:

    image

  • 相关阅读:
    idea_pyspark 环境配置
    Win7 单机Spark和PySpark安装
    Spark在Windows下的环境搭建
    linux 登陆key生成
    nginx 根据参数选择文档根目录
    系统操作日志设计(转)
    smarty、smarty格式化、smarty整数、smarty float、smarty各种转换方式、smarty日期转换等等 (转)
    Mac下面的SecureCRT(附破解方案) 更新到最新的7.3.2(转)
    nginx php-fpm 输出php错误日志
    解决PHP显示Warning和Notice等问题
  • 原文地址:https://www.cnblogs.com/junqilian/p/3394627.html
Copyright © 2011-2022 走看看