コード例 #1
0
        private async Task ProvisionBuildPathPermissionsAsync(
            Waddle.AdoConnectionFactory factory,
            Waddle.Dtos.Project project, PipelineFolder bp, VstsFolder existingItem)
        {
            if (existingItem != null)
            {
                var secService     = factory.GetSecurityNamespaceService();
                var buildNamespace = await secService.GetNamespaceAsync(SecurityNamespaceConstants.Build);

                var namespaceId   = buildNamespace.NamespaceId;
                var aclDictioanry = new Dictionary <string, VstsAcesDictionaryEntry>();
                await CreateAclsAsync(factory, typeof(Waddle.Constants.Build), bp.Permissions, aclDictioanry);

                if (aclDictioanry.Count > 0)
                {
                    var fpath      = bp.Path.TrimStart("\\/".ToCharArray()).Replace("\\", "/");
                    var token      = $"{project.Id}/{fpath}";
                    var aclService = factory.GetAclListService();
                    await aclService.SetAclsAsync(namespaceId, token, aclDictioanry, false);
                }
            }
        }
コード例 #2
0
        protected async Task ProvisionReleasePathPermissionsAsync(
            Kdoctl.CliServices.AzDoServices.Dtos.Project project, PipelineFolder rp, VstsFolder existingItem)
        {
            if (existingItem != null)
            {
                var secService     = GetSecurityNamespaceService();
                var buildNamespace = await secService.GetNamespaceAsync(SecurityNamespaceConstants.ReleaseManagement,
                                                                        ReleaseManagementEx.AdministerReleasePermissions.ToString());

                var namespaceId   = buildNamespace.NamespaceId;
                var aclDictioanry = new Dictionary <string, VstsAcesDictionaryEntry>();
                await CreateAclsAsync(typeof(ReleaseManagementEx), rp.Permissions, aclDictioanry);

                if (aclDictioanry.Count > 0)
                {
                    var fpath      = rp.Path.TrimStart("\\/".ToCharArray()).Replace("\\", "/");
                    var token      = $"{project.Id}/{fpath}";
                    var aclService = GetAclListService();
                    await aclService.SetAclsAsync(namespaceId, token, aclDictioanry, false);
                }
            }
        }