惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
D
DataBreaches.Net
F
Full Disclosure
腾讯CDC
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
J
Java Code Geeks
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy International News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CERT Recently Published Vulnerability Notes
O
OpenAI News
Project Zero
Project Zero
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
Schneier on Security
Schneier on Security

博客园 - Seer Lin

自己开发的ERP系统,有需要的联系 MSCRM2016 取消邮箱强制SSL 不听话的下属辞职记 Windows 7下,巧让家用UPS也支持电脑自动关机 海蜘蛛去广告 [转]SQL2008链接服务器数据同步 asp.net 在IE8 导出excel时的问题 [转]mssql链接服务器 win2008 R2 64位系统下配置DCOM权限 [转]excel 操作类 在excel中,将 长*宽*高 这样的格式列,拆分成3列 将没有产品图片的产品设置为不在前台显示SQL实现 [转]在Reporting Services报表中引用FTP站点上的图片 mscrm js webservic 常用功能 mscrm4.0 判断当前用户角色_示例 mscrm4.0 获取当前登录的用户名 mscrm4.0 用js调用Webservice vs2010 js 代码折叠插件 MSCRM 删除客户数据 MSCRM offline plugin开发注意事项
mscrm 4.0 获取当前用户角色
Seer Lin · 2011-03-16 · via 博客园 - Seer Lin

var script = document.createElement('script');
script.setAttribute(
'runat''server');
script.setAttribute(
'language''javascript');
script.text 
= "function UserHasRole(roleName){var oXml = GetCurrentUserRoles();if(oXml != null){var roles = oXml.selectNodes(\'//BusinessEntity/q1:name\');if(roles != null){for( i = 0; i < roles.length; i++){if(roles[i].text == roleName){return true;}}}}return false;}function GetCurrentUserRoles(){var xml =\"<?xml version=\'1.0\' encoding=\'utf-8\'?><soap:Envelope xmlns:soap=\'http://schemas.xmlsoap.org/soap/envelope/\' xmlns:xsi=\'http://www.w3.org/2001/XMLSchema-instance\' xmlns:xsd=\'http://www.w3.org/2001/XMLSchema\'>\" + GenerateAuthenticationHeader() + \" <soap:Body><RetrieveMultiple xmlns=\'http://schemas.microsoft.com/crm/2007/WebServices\'><query xmlns:q1=\'http://schemas.microsoft.com/crm/2006/Query\' xsi:type=\'q1:QueryExpression\'><q1:EntityName>role</q1:EntityName><q1:ColumnSet xsi:type=\'q1:ColumnSet\'><q1:Attributes><q1:Attribute>name</q1:Attribute></q1:Attributes></q1:ColumnSet><q1:Distinct>false</q1:Distinct><q1:LinkEntities><q1:LinkEntity><q1:LinkFromAttributeName>roleid</q1:LinkFromAttributeName><q1:LinkFromEntityName>role</q1:LinkFromEntityName><q1:LinkToEntityName>systemuserroles</q1:LinkToEntityName><q1:LinkToAttributeName>roleid</q1:LinkToAttributeName><q1:JoinOperator>Inner</q1:JoinOperator><q1:LinkEntities><q1:LinkEntity><q1:LinkFromAttributeName>systemuserid</q1:LinkFromAttributeName><q1:LinkFromEntityName>systemuserroles</q1:LinkFromEntityName><q1:LinkToEntityName>systemuser</q1:LinkToEntityName><q1:LinkToAttributeName>systemuserid</q1:LinkToAttributeName><q1:JoinOperator>Inner</q1:JoinOperator><q1:LinkCriteria><q1:FilterOperator>And</q1:FilterOperator><q1:Conditions><q1:Condition><q1:AttributeName>systemuserid</q1:AttributeName><q1:Operator>EqualUserId</q1:Operator></q1:Condition></q1:Conditions></q1:LinkCriteria></q1:LinkEntity></q1:LinkEntities></q1:LinkEntity></q1:LinkEntities></query></RetrieveMultiple></soap:Body></soap:Envelope>\";var xmlHttpRequest = new ActiveXObject(\'Msxml2.XMLHTTP\');xmlHttpRequest.Open(\'POST\', \'/mscrmservices/2007/CrmService.asmx\', false);xmlHttpRequest.setRequestHeader(\'SOAPAction\',\'http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple\');xmlHttpRequest.setRequestHeader(\'Content-Type\', \'text/xml; charset=utf-8\');xmlHttpRequest.setRequestHeader(\'Content-Length\', xml.length);xmlHttpRequest.send(xml);var resultXml = xmlHttpRequest.responseXML;return(resultXml);}function GetCurrentUserId(){var soapBody = \"<soap:Body><Execute xmlns=\'http://schemas.microsoft.com/crm/2007/WebServices\'><Request xsi:type=\'WhoAmIRequest\' /></Execute></soap:Body>\";var soapXml = \"<soap:Envelope  xmlns:soap=\'http://schemas.xmlsoap.org/soap/envelope/\' xmlns:xsi=\'http://www.w3.org/2001/XMLSchema-instance\' xmlns:xsd=\'http://www.w3.org/2001/XMLSchema\'>\" + GenerateAuthenticationHeader() + soapBody + \"</soap:Envelope>\";var xmlhttp = new ActiveXObject(\'Msxml2.XMLHTTP\');xmlhttp.open(\'POST\', \'/MSCRMservices/2007/crmservice.asmx\', false);xmlhttp.setRequestHeader(\'Content-Type\', \'text/xml;charset=utf-8\');xmlhttp.setRequestHeader(\'SOAPAction\', \'http://schemas.microsoft.com/crm/2007/WebServices/Execute\');xmlhttp.send(soapXml);xmlDoc= new ActiveXObject(\'Microsoft.XMLDOM\');xmlDoc.async=false;xmlDoc.loadXML(xmlhttp.responseXML.xml);return xmlDoc.getElementsByTagName(\'UserId\')[0].childNodes[0].nodeValue;}"
document.head 
= document.documentElement.firstChild;
document.head.appendChild(script);