{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/86595679","pull_request_review_id":7249082,"id":86595679,"diff_hunk":"@@ -2,25 +2,300 @@\n // The .NET Foundation licenses this file to you under the MIT license.\n // See the LICENSE file in the project root for more information.\n \n+using System.Collections;\n+using System.Collections.Generic;\n+using System.Security.Principal;\n+using System.Threading;\n+\n namespace System.Security.Permissions\n {\n-    //TODO #9641: Implement PrincipalPermission with real behavior\n     [Serializable]\n-    public sealed partial class PrincipalPermission : IPermission, ISecurityEncodable, IUnrestrictedPermission\n+    public sealed class PrincipalPermission : IPermission, ISecurityEncodable, IUnrestrictedPermission\n     {\n-        public PrincipalPermission(PermissionState state) { }\n-        public PrincipalPermission(string name, string role) { }\n-        public PrincipalPermission(string name, string role, bool isAuthenticated) { }\n-        public IPermission Copy() { return default(IPermission); }\n-        public void Demand() { throw new SecurityException(); }\n-        public override bool Equals(object o) => base.Equals(o);\n-        public void FromXml(SecurityElement elem) { }\n-        public override int GetHashCode() => base.GetHashCode();\n-        public IPermission Intersect(IPermission target) { return default(IPermission); }\n-        public bool IsSubsetOf(IPermission target) { return false; }\n-        public bool IsUnrestricted() { return false; }\n-        public override string ToString() => base.ToString();\n-        public SecurityElement ToXml() { return default(SecurityElement); }\n-        public IPermission Union(IPermission other) { return default(IPermission); }\n+        private IDRole[] _idArray;\n+\n+        public PrincipalPermission(PermissionState state)\n+        {\n+            if (state == PermissionState.Unrestricted)\n+            {\n+                _idArray = new IDRole[] { new IDRole(true, null, null) };\n+            }\n+            else if (state == PermissionState.None)\n+            {\n+                _idArray = new IDRole[] { new IDRole(false, \"\", \"\") };","path":"src/System.Security.Permissions/src/System/Security/Permissions/PrincipalPermission.cs","position":40,"original_position":40,"commit_id":"e71e13ba1dd40ceb6fac930f61222416386f97d9","original_commit_id":"e71e13ba1dd40ceb6fac930f61222416386f97d9","user":{"login":"AlexGhiondea","id":8396979,"avatar_url":"https://avatars.githubusercontent.com/u/8396979?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexGhiondea","html_url":"https://github.com/AlexGhiondea","followers_url":"https://api.github.com/users/AlexGhiondea/followers","following_url":"https://api.github.com/users/AlexGhiondea/following{/other_user}","gists_url":"https://api.github.com/users/AlexGhiondea/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexGhiondea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexGhiondea/subscriptions","organizations_url":"https://api.github.com/users/AlexGhiondea/orgs","repos_url":"https://api.github.com/users/AlexGhiondea/repos","events_url":"https://api.github.com/users/AlexGhiondea/events{/privacy}","received_events_url":"https://api.github.com/users/AlexGhiondea/received_events","type":"User","site_admin":false},"body":">\"\" [](start = 60, length = 2)\r\n\r\nstring.Empty?","created_at":"2016-11-04T17:34:16Z","updated_at":"2016-11-04T17:34:16Z","html_url":"https://github.com/dotnet/corefx/pull/13275#discussion_r86595679","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/13275","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/86595679"},"html":{"href":"https://github.com/dotnet/corefx/pull/13275#discussion_r86595679"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/13275"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/13275","id":92033820,"html_url":"https://github.com/dotnet/corefx/pull/13275","diff_url":"https://github.com/dotnet/corefx/pull/13275.diff","patch_url":"https://github.com/dotnet/corefx/pull/13275.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/13275","number":13275,"state":"open","locked":false,"title":"Implement System.Security.PrincipalPermission and SecurityElement","user":{"login":"ianhays","id":2606879,"avatar_url":"https://avatars.githubusercontent.com/u/2606879?v=3","gravatar_id":"","url":"https://api.github.com/users/ianhays","html_url":"https://github.com/ianhays","followers_url":"https://api.github.com/users/ianhays/followers","following_url":"https://api.github.com/users/ianhays/following{/other_user}","gists_url":"https://api.github.com/users/ianhays/gists{/gist_id}","starred_url":"https://api.github.com/users/ianhays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianhays/subscriptions","organizations_url":"https://api.github.com/users/ianhays/orgs","repos_url":"https://api.github.com/users/ianhays/repos","events_url":"https://api.github.com/users/ianhays/events{/privacy}","received_events_url":"https://api.github.com/users/ianhays/received_events","type":"User","site_admin":false},"body":"- Ports desktop code for SecurityELement and PrincipalPermission\r\n- To be used in Security.Permissions, some of the members in System.Sec.Principal.Windows need to be moved into common.\r\n- Fixes the old desktop implementation of the two functions to work in .net core. Originally the plan was to only implement PrincipalPermission, but it relied heavily on SecurityElement functionality so I opted to implement that as well. The only remaining item not fully implemented is SecurityElement.FromString.\r\n- Required splitting PrincipalPermission (and the assembly) based on Unix/Windows.\r\n- Adds tests for SecurityElement and PrincipalPermission\r\n\r\nresolves https://github.com/dotnet/corefx/issues/9641\r\n\r\n@AlexGhiondea @joperezr @stephentoub ","created_at":"2016-11-02T18:56:14Z","updated_at":"2016-11-04T17:34:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2fdcc955dec64eb4be2e7272115070c4b9e237fa","assignee":{"login":"ianhays","id":2606879,"avatar_url":"https://avatars.githubusercontent.com/u/2606879?v=3","gravatar_id":"","url":"https://api.github.com/users/ianhays","html_url":"https://github.com/ianhays","followers_url":"https://api.github.com/users/ianhays/followers","following_url":"https://api.github.com/users/ianhays/following{/other_user}","gists_url":"https://api.github.com/users/ianhays/gists{/gist_id}","starred_url":"https://api.github.com/users/ianhays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianhays/subscriptions","organizations_url":"https://api.github.com/users/ianhays/orgs","repos_url":"https://api.github.com/users/ianhays/repos","events_url":"https://api.github.com/users/ianhays/events{/privacy}","received_events_url":"https://api.github.com/users/ianhays/received_events","type":"User","site_admin":false},"assignees":[{"login":"ianhays","id":2606879,"avatar_url":"https://avatars.githubusercontent.com/u/2606879?v=3","gravatar_id":"","url":"https://api.github.com/users/ianhays","html_url":"https://github.com/ianhays","followers_url":"https://api.github.com/users/ianhays/followers","following_url":"https://api.github.com/users/ianhays/following{/other_user}","gists_url":"https://api.github.com/users/ianhays/gists{/gist_id}","starred_url":"https://api.github.com/users/ianhays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianhays/subscriptions","organizations_url":"https://api.github.com/users/ianhays/orgs","repos_url":"https://api.github.com/users/ianhays/repos","events_url":"https://api.github.com/users/ianhays/events{/privacy}","received_events_url":"https://api.github.com/users/ianhays/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/dotnet/corefx/milestones/4","html_url":"https://github.com/dotnet/corefx/milestones/1.2.0","labels_url":"https://api.github.com/repos/dotnet/corefx/milestones/4/labels","id":1248719,"number":4,"title":"1.2.0","description":".NET Core 1.2 Placeholder.  https://github.com/dotnet/core/blob/master/roadmap.md","creator":{"login":"joshfree","id":1302850,"avatar_url":"https://avatars.githubusercontent.com/u/1302850?v=3","gravatar_id":"","url":"https://api.github.com/users/joshfree","html_url":"https://github.com/joshfree","followers_url":"https://api.github.com/users/joshfree/followers","following_url":"https://api.github.com/users/joshfree/following{/other_user}","gists_url":"https://api.github.com/users/joshfree/gists{/gist_id}","starred_url":"https://api.github.com/users/joshfree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshfree/subscriptions","organizations_url":"https://api.github.com/users/joshfree/orgs","repos_url":"https://api.github.com/users/joshfree/repos","events_url":"https://api.github.com/users/joshfree/events{/privacy}","received_events_url":"https://api.github.com/users/joshfree/received_events","type":"User","site_admin":false},"open_issues":541,"closed_issues":1502,"state":"open","created_at":"2015-08-10T18:04:00Z","updated_at":"2016-11-04T17:32:25Z","due_on":"2017-04-30T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/13275/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/13275/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/13275/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/e71e13ba1dd40ceb6fac930f61222416386f97d9","head":{"label":"ianhays:api_security_principal","ref":"api_security_principal","sha":"e71e13ba1dd40ceb6fac930f61222416386f97d9","user":{"login":"ianhays","id":2606879,"avatar_url":"https://avatars.githubusercontent.com/u/2606879?v=3","gravatar_id":"","url":"https://api.github.com/users/ianhays","html_url":"https://github.com/ianhays","followers_url":"https://api.github.com/users/ianhays/followers","following_url":"https://api.github.com/users/ianhays/following{/other_user}","gists_url":"https://api.github.com/users/ianhays/gists{/gist_id}","starred_url":"https://api.github.com/users/ianhays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianhays/subscriptions","organizations_url":"https://api.github.com/users/ianhays/orgs","repos_url":"https://api.github.com/users/ianhays/repos","events_url":"https://api.github.com/users/ianhays/events{/privacy}","received_events_url":"https://api.github.com/users/ianhays/received_events","type":"User","site_admin":false},"repo":{"id":37934303,"name":"corefx","full_name":"ianhays/corefx","owner":{"login":"ianhays","id":2606879,"avatar_url":"https://avatars.githubusercontent.com/u/2606879?v=3","gravatar_id":"","url":"https://api.github.com/users/ianhays","html_url":"https://github.com/ianhays","followers_url":"https://api.github.com/users/ianhays/followers","following_url":"https://api.github.com/users/ianhays/following{/other_user}","gists_url":"https://api.github.com/users/ianhays/gists{/gist_id}","starred_url":"https://api.github.com/users/ianhays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianhays/subscriptions","organizations_url":"https://api.github.com/users/ianhays/orgs","repos_url":"https://api.github.com/users/ianhays/repos","events_url":"https://api.github.com/users/ianhays/events{/privacy}","received_events_url":"https://api.github.com/users/ianhays/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ianhays/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":true,"url":"https://api.github.com/repos/ianhays/corefx","forks_url":"https://api.github.com/repos/ianhays/corefx/forks","keys_url":"https://api.github.com/repos/ianhays/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ianhays/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ianhays/corefx/teams","hooks_url":"https://api.github.com/repos/ianhays/corefx/hooks","issue_events_url":"https://api.github.com/repos/ianhays/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/ianhays/corefx/events","assignees_url":"https://api.github.com/repos/ianhays/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/ianhays/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/ianhays/corefx/tags","blobs_url":"https://api.github.com/repos/ianhays/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ianhays/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ianhays/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/ianhays/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ianhays/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/ianhays/corefx/languages","stargazers_url":"https://api.github.com/repos/ianhays/corefx/stargazers","contributors_url":"https://api.github.com/repos/ianhays/corefx/contributors","subscribers_url":"https://api.github.com/repos/ianhays/corefx/subscribers","subscription_url":"https://api.github.com/repos/ianhays/corefx/subscription","commits_url":"https://api.github.com/repos/ianhays/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/ianhays/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/ianhays/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/ianhays/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/ianhays/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/ianhays/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ianhays/corefx/merges","archive_url":"https://api.github.com/repos/ianhays/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ianhays/corefx/downloads","issues_url":"https://api.github.com/repos/ianhays/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/ianhays/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/ianhays/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/ianhays/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ianhays/corefx/labels{/name}","releases_url":"https://api.github.com/repos/ianhays/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/ianhays/corefx/deployments","created_at":"2015-06-23T17:36:59Z","updated_at":"2016-01-11T18:31:07Z","pushed_at":"2016-11-04T16:40:23Z","git_url":"git://github.com/ianhays/corefx.git","ssh_url":"git@github.com:ianhays/corefx.git","clone_url":"https://github.com/ianhays/corefx.git","svn_url":"https://github.com/ianhays/corefx","homepage":"http://dotnet.github.io/core/","size":113059,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"4617b94842c078e4ba2561edfc4d51c5bbc0c829","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":26295345,"name":"corefx","full_name":"dotnet/corefx","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/corefx/deployments","created_at":"2014-11-06T23:42:48Z","updated_at":"2016-11-04T17:16:55Z","pushed_at":"2016-11-04T17:30:42Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"https://docs.microsoft.com/dotnet/","size":159434,"stargazers_count":10747,"watchers_count":10747,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2711,"mirror_url":null,"open_issues_count":1445,"forks":2711,"open_issues":1445,"watchers":10747,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/13275"},"html":{"href":"https://github.com/dotnet/corefx/pull/13275"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/13275"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/13275/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/13275/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/13275/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/e71e13ba1dd40ceb6fac930f61222416386f97d9"}}}}
{"actor":{"display_login":"AlexGhiondea"}}