private async static Task CheckProjectPermission(WorkItemClientConnection client, string project, int requestedPermission) { Logger.LogInformation($"Checking project security permissions for {client.Connection.AuthorizedIdentity.DisplayName} in {project}"); SecurityHttpClient securityHttpClient = null; ProjectHttpClient projectHttpClient = null; TeamProject teamProject = null; try { securityHttpClient = client.Connection.GetClient <SecurityHttpClient>(); projectHttpClient = client.Connection.GetClient <ProjectHttpClient>(); teamProject = await projectHttpClient.GetProject(project); } catch (Exception e) when(e.InnerException is VssUnauthorizedException) { throw new ValidationException(client.Connection.Uri.ToString(), (VssUnauthorizedException)e.InnerException); } catch (Exception e) { throw new ValidationException("An unexpected error occurred while reading the classification nodes to validate project permissions", e); } await HasPermission(securityHttpClient, project, $"$PROJECT:vstfs:///Classification/TeamProject/{teamProject.Id}", ProjectSecurityNamespace, requestedPermission); }
public SecurityNamespaceDescription GetGitSecurityNamespace() { VssConnection connection = this.Context.Connection; SecurityHttpClient securityClient = connection.GetClient<SecurityHttpClient>(); IEnumerable<SecurityNamespaceDescription> namespaces = securityClient.QuerySecurityNamespacesAsync(this.GitSecurityNamespace).Result; SecurityNamespaceDescription gitNamespace = namespaces.First(); Console.WriteLine("{0}", gitNamespace.DisplayName); foreach (ActionDefinition actionDef in gitNamespace.Actions) { string knownBit = ""; if (actionDef.Bit == gitNamespace.ReadPermission) { knownBit += " [Read]"; } if (actionDef.Bit == gitNamespace.WritePermission) { knownBit += " [Write]"; } Console.WriteLine("\"{0}\" ({1}){2}", actionDef.DisplayName ?? actionDef.Name, actionDef.Bit, knownBit); } return gitNamespace; }
private async static Task HasPermission(SecurityHttpClient securityHttpClient, string project, string token, Guid securityNamespace, int requestedPermission) { bool hasPermission = false; try { hasPermission = await securityHttpClient.HasPermissionAsync( securityNamespace, token, requestedPermission, false); } catch (Exception e) { throw new ValidationException($"An unexpected error occurred while trying to check permissions for project {token} in namespace {securityNamespace}", e); } if (hasPermission) { Logger.LogSuccess(LogDestination.All, $"Verified security permissions for {token} project"); } else { throw new ValidationException($"You do not have the necessary security permissions for {token}, work item permission: {requestedPermission} is required."); } }
public ResponseInfo <FeeResponseDatamap> GetFee(string ordertype, string amount, string providerid, int orderfrom, string memberId = null) { var config = new ApiSetting(null); FeeRequestDatamap info = new FeeRequestDatamap() { orderType = ordertype, amount = amount, providerCode = providerid, memberId = memberId == null ? config.DefaultMemberId : memberId }; var response = SecurityHttpClient.Post <FeeRequestDatamap, FeeResponseDatamap>(config.JavaFee_Uri, info, orderfrom.ToString(), "v1"); switch (response.respCode) { case "CS00002": throw new ErrorCodeException(response.respCode, "金额不能为空"); case "CS00004": throw new ErrorCodeException(response.respCode, "请求来源不能为空"); case "CS00005": throw new ErrorCodeException(response.respCode, "订单类型不能为空"); case "00006": throw new ErrorCodeException(response.respCode, "版本信息错误"); case "00002": throw new ErrorCodeException(response.respCode, "Java获取数据超时,请稍后重试!"); } return(response); }
public IEnumerable <AccessControlList> ListAllGitAcls() { VssConnection connection = this.Context.Connection; SecurityHttpClient securityClient = connection.GetClient <SecurityHttpClient>(); IEnumerable <AccessControlList> acls = securityClient.QueryAccessControlListsAsync( // in a real app, you should get this value via securityClient.QuerySecurityNamespacesAsync GitSecurityNamespace, string.Empty, descriptors: null, includeExtendedInfo: false, recurse: true).Result; // we'll store one interesting ACE to expand in a later method bool storedAcl = false; Console.WriteLine("token | inherit? | count of ACEs"); Console.WriteLine("------+----------+--------------"); foreach (AccessControlList acl in acls) { Console.WriteLine("{0} | {1} | {2} ACEs", acl.Token, acl.InheritPermissions, acl.AcesDictionary.Count()); if (!storedAcl && acl.Token.Length > "repoV2/".Length) { this.Context.SetValue(this.StoredAclKey, acl); storedAcl = true; } } return(acls); }
public ActionResult LostCoffee(CoffeeInit req) { var clientInfo = this.TempData["ClientInfo"] as ClientInfo; string EtmID = clientInfo.EtmCode; //string EtmID = "ETM0027"; var list = ObjectXmlSerializer.LoadFromXml <List <CoffeeInit> >(Server.MapPath("~/cache/Coffee.xml")); if (list.Find(o => o.EtmID == EtmID).CupNumber < req.CupNumber) { return(this.Json(new { retCode = 1, Message = "提交失败,饮品剩余数量不足!" })); } list.Find(o => o.EtmID == EtmID).CupNumber -= req.CupNumber; //检测剩余杯数,发短信 try { if (list.Find(o => o.EtmID == EtmID).CupNumber <= int.Parse(ConfigurationManager.AppSettings["EnableSmsCupNumber"]) && list.Find(o => o.EtmID == EtmID).SendSMS == "0" && ConfigurationManager.AppSettings["EnableSms"] == "true") { list.Find(o => o.EtmID == EtmID).CupNumber = 1; const string takedateUrl = "api/Coffee/SendSms"; var fullPath = ETong.Coffee.Web.Models.Config.GetApiFullPath(takedateUrl); var client = new HttpClientUtility(new Uri(fullPath)); Logger.Write(Log.Log_Type.Info, string.Format("调用{0}", fullPath)); var resultT = SecurityHttpClient.Post <string, ResponseData <string> >(fullPath, EtmID); Logger.Write(Log.Log_Type.Info, string.Format("{0}结束,result={1}", fullPath, Json(resultT.dataMap))); } } catch (Exception ex) { Logger.Write(Log.Log_Type.Info, string.Format("短信发送失败etmid={0},err={1}", EtmID, ex.ToString())); } Logger.Write(Log.Log_Type.Info, string.Format("减库存etmid={0},CupNumber={1}", EtmID, req.CupNumber)); ObjectXmlSerializer.SaveToXml <List <CoffeeInit> >(Server.MapPath("~/cache/Coffee.xml"), list); return(this.Json(new { retCode = 0, Message = "成功" })); }
public ResponseInfo <CreateOrderOrderResult> CreateOrder(OrderInfo orderinfo) { _log.Debug("order data:" + JsonConvert.SerializeObject(orderinfo)); ApiSetting setting = new ApiSetting(null); if (string.IsNullOrWhiteSpace(orderinfo.memberId)) { orderinfo.memberId = setting.DefaultMemberId; orderinfo.memberName = "匿名用户"; } var datmap = new CreateOrderDatamap() { memberId = orderinfo.memberId, orderList = new OrderInfo[] { orderinfo } }; var response = SecurityHttpClient.Post <CreateOrderDatamap, CreateOrderOrderResult>(setting.JavaOrder_Uri + "generateOrder", datmap); if (response == null) { throw new ApplicationException("调用java下单接口失败!"); } if (response.respCode != "0") { throw new ApplicationException("调用java下单接口失败!" + response.respCode + ":" + response.respMsg); } if (response.dataMap == null) { throw new ApplicationException("调用java下单接口失败!返回数据为null"); } response.dataMap.orderId = response.dataMap.orderIds.First().Value; return(response); }
public static void ListGitNamespacePermissions() { SecurityHttpClient securityClient = connection.GetClient <SecurityHttpClient>(); Guid g = Guid.Parse("2e9eb7ed-3c0a-47d4-87c1-0ffdd275fd87"); //Git security namespace IEnumerable <Microsoft.VisualStudio.Services.Security.SecurityNamespaceDescription> namespaces = securityClient.QuerySecurityNamespacesAsync(g).Result; Microsoft.VisualStudio.Services.Security.SecurityNamespaceDescription gitNamespace = namespaces.First(); IEnumerable <Microsoft.VisualStudio.Services.Security.AccessControlList> acls = securityClient.QueryAccessControlListsAsync( g, string.Empty, descriptors: null, includeExtendedInfo: false, recurse: true).Result; using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\TFSAdminAutomationData\out_GitAccessControlLists.txt")) { int counter = 0; file.WriteLine("token | inherit? | count of ACEs"); file.WriteLine("------+----------+--------------"); foreach (Microsoft.VisualStudio.Services.Security.AccessControlList acl in acls) { counter++; string[] tokenParser = acl.Token.Split('/'); if (tokenParser.Length != 2) //we are interested in team project level git security { continue; } file.WriteLine(); file.WriteLine(); file.WriteLine("{0} | {1} | {2} ACEs", acl.Token, acl.InheritPermissions, acl.AcesDictionary.Count()); file.WriteLine("Project Name: " + GetProjectName(tokenParser[1])); file.WriteLine("Expanding ACL for {0} ({1} ACEs)", acl.Token, acl.AcesDictionary.Count()); // get the details for Git permissions Dictionary <int, string> permission = GetGitPermissionNames(); // use the Git permissions data to expand the ACL foreach (var kvp in acl.AcesDictionary) { // in the key-value pair, Key is an identity and Value is an ACE (access control entry) // allow and deny are bit flags indicating which permissions are allowed/denied string identity = kvp.Key.Identifier.ToString(); file.WriteLine("Identity {0}", identity); string identityName = GetNameFromIdentity(identity); file.WriteLine("Identity Name {0}", identityName); if (!identityName.EndsWith("Project Administrators")) { continue; } string allowed = GetPermissionString(kvp.Value.Allow, permission); string denied = GetPermissionString(kvp.Value.Deny, permission); file.WriteLine(" Allowed: {0} (value={1})", allowed, kvp.Value.Allow); file.WriteLine(" Denied: {0} (value={1})", denied, kvp.Value.Deny); } } } }
public ResponseInfo <GetOrdersDatamap> Gets(GetOrdersCondition condition) { var config = new ApiSetting(null); var response = SecurityHttpClient.Post <GetOrdersCondition, GetOrdersDatamap>(config.JavaOrder_Uri + "queryOrders", condition); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
/// <summary> /// 获取订单 /// </summary> /// <param name="groupId"></param> /// <returns></returns> public ResponseData <CoffeeOrder> GetOrder(string groupId) { string takedateUrl = string.Format("api/Coffee/GetOrderDetail?groupId={0}", groupId); var fullPath = ETong.Coffee.Web.Models.Config.GetApiFullPath(takedateUrl); var client = new HttpClientUtility(new Uri(fullPath)); Logger.Write(Log.Log_Type.Info, string.Format("调用{0}", fullPath)); var result = SecurityHttpClient.Get <ResponseData <CoffeeOrder> >(fullPath); Logger.Write(Log.Log_Type.Info, string.Format("{0}结束,result={1}", fullPath, Json(result.dataMap))); return(result.dataMap); }
/// <summary> /// 完成回调 /// </summary> /// <param name="groupId"></param> /// <returns></returns> public ActionResult FinishCallBack(string groupId) { const string takedateUrl = "api/Coffee/FinishCallBack"; var fullPath = ETong.Coffee.Web.Models.Config.GetApiFullPath(takedateUrl); var client = new HttpClientUtility(new Uri(fullPath)); Logger.Write(Log.Log_Type.Info, string.Format("调用{0}", fullPath)); var result = SecurityHttpClient.Post <string, ResponseData <string> >(fullPath, groupId); Logger.Write(Log.Log_Type.Info, string.Format("{0}结束,result={1}", fullPath, Json(result.dataMap))); return(Json(result.dataMap)); }
public ResponseInfo <CreateOrderOrderResult> CreateMallOrder(MallOrderInfos orderinfos) { _log.Debug("order data:" + JsonConvert.SerializeObject(orderinfos)); var config = new ApiSetting(null); var response = SecurityHttpClient.Post <MallOrderInfos, CreateOrderOrderResult>(config.JavaOrder_Uri + "generateOrder", orderinfos); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
internal IEnumerable <AccessControlList> ListAccessControl(Guid identify) { SecurityHttpClient securityClient = connection.GetClient <SecurityHttpClient>(); IEnumerable <SecurityNamespaceDescription> namespaces = securityClient.QuerySecurityNamespacesAsync(identify).Result; IEnumerable <AccessControlList> acls = securityClient.QueryAccessControlListsAsync( identify, string.Empty, descriptors: null, includeExtendedInfo: false, recurse: true).Result; return(acls); }
static IEnumerable <AccessControlList> GetReleaseDefinitionAccessControlList(VssConnection connection, Guid projectId, int releaseDefinitionId) { // We need the security client to talk to RM service instead of the default TFS to get us the ACLs for release definition SecurityHttpClient securityHttpClient = connection.GetClient <SecurityHttpClient>(Guid.Parse(ReleaseManagementApiConstants.InstanceType)); var acls = securityHttpClient.QueryAccessControlListsAsync( SecurityConstants.ReleaseManagementSecurityNamespaceId, CreateToken(projectId, releaseDefinitionId), null, // all desciptors true, true).Result; return(acls); }
public void HandleShip(string orderid, string memberid) { var config = new ApiSetting(null); HandleShipRequest info = new HandleShipRequest() { orderId = orderid, memberId = memberid }; var response = SecurityHttpClient.Post <HandleShipRequest, HandleShipResponse>(config.JavaOrder_Uri + "convenShipping", info, "1", "v1"); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } }
public void GetReleaseDefinitionAccessControlLists() { VssConnection connection = Context.Connection; var project = ClientSampleHelpers.FindAnyProject(this.Context); // We need the security client to talk to RM service instead of the default TFS to get us the ACLs for release definition SecurityHttpClient securityHttpClient = connection.GetClient <SecurityHttpClient>(Guid.Parse(ReleaseManagementApiConstants.InstanceType)); var acls = securityHttpClient.QueryAccessControlListsAsync( SecurityConstants.ReleaseManagementSecurityNamespaceId, CreateToken(project.Id, newlyCreatedReleaseDefinitionId), null, // all desciptors true, true).Result; }
public async static Task CheckConnection(WorkItemClientConnection client, string project, int requestedPermission) { Logger.LogInformation($"Checking security permissions for {client.Connection.AuthorizedIdentity.DisplayName} in {project}"); bool hasPermission = false; SecurityHttpClient securityHttpClient = null; WorkItemClassificationNode result = null; try { securityHttpClient = client.Connection.GetClient <SecurityHttpClient>(); result = await WorkItemTrackingHelpers.GetClassificationNode(client.WorkItemTrackingHttpClient, project, TreeStructureGroup.Areas); } catch (Exception e) when(e.InnerException is VssUnauthorizedException) { throw new ValidationException(client.Connection.Uri.ToString(), (VssUnauthorizedException)e.InnerException); } catch (Exception e) { throw new ValidationException("An unexpected error occurred while reading the classification nodes to validate project permissions", e); } //construct the token by appending the id string token = $"vstfs:///Classification/Node/{result.Identifier}"; //WORK_ITEM guid is hardcoded below //securityNameSpaceId for WORK_ITEM is 83e28ad4-2d72-4ceb-97b0-c7726d5502c3 try { hasPermission = await securityHttpClient.HasPermissionAsync( new Guid("83e28ad4-2d72-4ceb-97b0-c7726d5502c3"), token, requestedPermission, false); } catch (Exception e) { throw new ValidationException($"An unexpected error occurred while trying to check permissions for project {project}", e); } if (hasPermission) { Logger.LogSuccess(LogDestination.All, $"Verified security permissions for {project} project"); } else { throw new ValidationException($"You do not have the necessary security permissions for {project}, work item {(requestedPermission == WritePermission ? "write" : "read")} permissions are required."); } }
internal List <Permission> GitPermissionsDetails(AccessControlList acessControlList, IEnumerable <GraphUser> users, IEnumerable <GraphGroup> groups, List <GitRepository> repositories) { List <Permission> permissions = new List <Permission>(); Regex extractEmail = new Regex(@"\\(.*$)"); Regex extractGuid = new Regex(@".{8}-.{9}-.{4}-.{12}"); GitHttpClient gitClient = connection.GetClient <GitHttpClient>(); SecurityHttpClient securityClient = connection.GetClient <SecurityHttpClient>(); GraphHttpClient graphClient = connection.GetClient <GraphHttpClient>(); // Guid guid = Guid.Parse(acessControlList.Token.Remove(0, 7)); IEnumerable <AccessControlList> acls = securityClient.QueryAccessControlListsAsync( Guid.Parse("2e9eb7ed-3c0a-47d4-87c1-0ffdd275fd87"), acessControlList.Token, descriptors: null, includeExtendedInfo: false, recurse: true).Result; // get the details for Git permissions Dictionary <int, string> permission = GetGitPermissionNames(); var tokenGuids = extractGuid.Matches(acessControlList.Token); var lastGuidFromToken = Guid.Parse(tokenGuids[tokenGuids.Count - 1].Value); var repository = repositories.FirstOrDefault(r => r.Id.Equals(lastGuidFromToken)); var repositoryName = repository != null ? repository.Name : "<none>"; // use the Git permissions data to expand the ACL Console.WriteLine("Expanding ACL for {0} ({1} ACEs)", repositoryName, acessControlList.AcesDictionary.Count()); foreach (var kvp in acessControlList.AcesDictionary) { // in the key-value pair, Key is an identity and Value is an ACE (access control entry) // allow and deny are bit flags indicating which permissions are allowed/denied //PagedGraphUsers group = graphClient.GetGroupAsync(kvp.Key); //var user = users.First(u => u.Descriptor.ToString().Equals(kvp.Key.ToString())); var group = groups.FirstOrDefault(g => g.Descriptor.Identifier.Equals(kvp.Key.Identifier)); if (group != null) { AddByGroup(permissions, graphClient, permission, repositoryName, kvp, group); } else { AddByUser(users, permissions, extractEmail, permission, repositoryName, kvp); } } return(permissions); }
public ResponseInfo <CancelOrderDatamap> Cancel(string orderid, string memberid) { CancelOrderInfo info = new CancelOrderInfo() { memberId = memberid, orderId = orderid }; ApiSetting setting = new ApiSetting(null); var response = SecurityHttpClient.Post <CancelOrderInfo, CancelOrderDatamap>(setting.JavaOrder_Uri + "cancel", info); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
public ResponseInfo <RefundOrderDatamap> Refund(string orderid, string memberid) { RefundOrderInfo info = new RefundOrderInfo() { orderId = orderid }; var config = new ApiSetting(null); var response = SecurityHttpClient.Post <RefundOrderInfo, RefundOrderDatamap>(config.JavaOrder_Uri + "orderStatusRefund", info); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
public IEnumerable<SecurityNamespaceDescription> ListLocalSecurityNamespaces() { VssConnection connection = this.Context.Connection; SecurityHttpClient securityClient = connection.GetClient<SecurityHttpClient>(); IEnumerable<SecurityNamespaceDescription> namespaces = securityClient.QuerySecurityNamespacesAsync(Guid.Empty, localOnly: true).Result; Console.WriteLine("Listing local security namespaces"); foreach (SecurityNamespaceDescription ns in namespaces) { Console.WriteLine("{0} ({1}) - {2} permissions", ns.DisplayName ?? ns.Name, ns.NamespaceId, ns.Actions.Count()); } return namespaces; }
public ResponseInfo <TransferorderDatamap> GetTransferOrderDetail(string orderid, string memberid) { GetOrderCondition info = new GetOrderCondition() { memberId = memberid, orderId = orderid }; var config = new ApiSetting(null); var response = SecurityHttpClient.Post <GetOrderCondition, TransferorderDatamap>(config.JavaOrder_Uri + "queryOrdersById", info); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
public ResponseInfo <FinishOrderDatamap> Finish(string orderid, string memberid, string provideid) { FinishOrderInfo info = new FinishOrderInfo() { memberId = memberid, orderId = orderid, providerId = provideid }; var config = new ApiSetting(null); var response = SecurityHttpClient.Post <FinishOrderInfo, FinishOrderDatamap>(config.JavaOrder_Uri + "finishedCall", info); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
private async static Task CheckPermission(WorkItemClientConnection client, string project, Guid securityNamespace, int requestedPermission) { Logger.LogInformation($"Checking security permissions for {client.Connection.AuthorizedIdentity.DisplayName} in {project}"); bool hasPermission = false; SecurityHttpClient securityHttpClient = null; WorkItemClassificationNode result = null; try { securityHttpClient = client.Connection.GetClient <SecurityHttpClient>(); result = await WorkItemTrackingHelpers.GetClassificationNode(client.WorkItemTrackingHttpClient, project, TreeStructureGroup.Areas); } catch (Exception e) when(e.InnerException is VssUnauthorizedException) { throw new ValidationException(client.Connection.Uri.ToString(), (VssUnauthorizedException)e.InnerException); } catch (Exception e) { throw new ValidationException("An unexpected error occurred while reading the classification nodes to validate project permissions", e); } //construct the token by appending the id string token = $"vstfs:///Classification/Node/{result.Identifier}"; try { hasPermission = await securityHttpClient.HasPermissionAsync( securityNamespace, token, requestedPermission, false); } catch (Exception e) { throw new ValidationException($"An unexpected error occurred while trying to check permissions for project {project} in namespace {securityNamespace}", e); } if (hasPermission) { Logger.LogSuccess(LogDestination.All, $"Verified security permissions for {project} project"); } else { throw new ValidationException($"You do not have the necessary security permissions for {project}, work item permission: {requestedPermission} is required."); } }
public ActionResult UpdateOrderStatus() { string OrderId = Request.QueryString["OrderId"]; Logger.Write(Log.Log_Type.Info, string.Format("更新订单{0}", OrderId)); if (!string.IsNullOrWhiteSpace(OrderId)) { const string takedateUrl = "api/Coffee/FinishCallBack"; var fullPath = ETong.Coffee.Web.Models.Config.GetApiFullPath(takedateUrl); var client = new HttpClientUtility(new Uri(fullPath)); Logger.Write(Log.Log_Type.Info, string.Format("调用{0}", fullPath)); var result = SecurityHttpClient.Post <string, ResponseData <string> >(fullPath, OrderId); Logger.Write(Log.Log_Type.Info, string.Format("{0}结束,result={1}", fullPath, Json(result.dataMap))); ViewData["pageData"] = result; } return(View()); }
public ResponseInfo <UpdateProviderResopneBody> UpdateProvider(string orderid, string memberid, string providerid) { var info = new SendSupplierBody() { memberId = memberid, orderId = orderid, providerId = providerid }; var config = new ApiSetting(null); var response = SecurityHttpClient.Post <SendSupplierBody, UpdateProviderResopneBody>(config.JavaOrder_Uri + "updateProviderId", info); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
internal Dictionary <int, string> GetGitPermissionNames() { SecurityHttpClient securityClient = connection.GetClient <SecurityHttpClient>(); IEnumerable <SecurityNamespaceDescription> namespaces; namespaces = securityClient.QuerySecurityNamespacesAsync(GitId).Result; SecurityNamespaceDescription gitNamespace = namespaces.First(); Dictionary <int, string> permission = new Dictionary <int, string>(); foreach (ActionDefinition actionDef in gitNamespace.Actions) { permission[actionDef.Bit] = actionDef.DisplayName; } return(permission); }
public ActionResult OrderPost(CoffeeOrder ord) { var clientInfo = this.TempData["ClientInfo"] as ClientInfo; ord.CreateIP = clientInfo.Ip; ord.OrderETMID = clientInfo.EtmCode; //ord.OrderETMID = "ETM0027"; //ord.OrderFrom = 1; const string takedateUrl = "api/Coffee/OrderPost"; var fullPath = ETong.Coffee.Web.Models.Config.GetApiFullPath(takedateUrl); var client = new HttpClientUtility(new Uri(fullPath)); Logger.Write(Log.Log_Type.Info, string.Format("调用{0}", fullPath)); var result = SecurityHttpClient.Post <CoffeeOrder, OrderGroupResult>(fullPath, ord); Logger.Write(Log.Log_Type.Info, string.Format("{0}结束,result={1}", fullPath, Json(result.dataMap))); return(Json(result)); }
private static Dictionary <int, string> GetGitPermissionNames() { SecurityHttpClient securityClient = connection.GetClient <SecurityHttpClient>(); IEnumerable <Microsoft.VisualStudio.Services.Security.SecurityNamespaceDescription> namespaces; Guid g = Guid.Parse("2e9eb7ed-3c0a-47d4-87c1-0ffdd275fd87"); namespaces = securityClient.QuerySecurityNamespacesAsync(g).Result; Microsoft.VisualStudio.Services.Security.SecurityNamespaceDescription gitNamespace = namespaces.First(); Dictionary <int, string> permission = new Dictionary <int, string>(); foreach (Microsoft.VisualStudio.Services.Security.ActionDefinition actionDef in gitNamespace.Actions) { permission[actionDef.Bit] = actionDef.DisplayName; } return(permission); }
/// <summary> /// 通知发货失败 /// </summary> /// <param name="orderid">订单号</param> /// <param name="memberid">会员号</param> /// <param name="errormessage">错误信息</param> /// <param name="isReverseFail">是否冲正失败</param> public void NotifyShipFail(string orderid, string memberid, string errormessage, bool isReverseFail) { var config = new ApiSetting(null); ShipFailRequest info = new ShipFailRequest() { orderId = orderid, memberId = memberid }; info.orderSubStatus = "2"; if (isReverseFail) { info.orderSubStatus = "3"; } info.failReason = errormessage; var response = SecurityHttpClient.Post <ShipFailRequest, ShipFailResponse>(config.JavaOrder_Uri + "convenShippingFail", info, "1", "v1"); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } }