{"action":"created","comment":{"url":"https://api.github.com/repos/ProjetSigma/backend/pulls/comments/52713199","id":52713199,"diff_hunk":"@@ -33,6 +33,22 @@ class Meta(BasicUserSerializerMeta):\n \n     permissions = DRYPermissionsField(read_only=True)\n \n+    def create(self, fields):\n+        from sigma_core.models.group_member import GroupMember\n+        from sigma_core.models.cluster import Cluster\n+        try:\n+            request = self.context['request']\n+            input_clusters = request.data.get('clusters')\n+            if request.user.is_sigma_admin():\n+                fields['clusters'] = Cluster.objects.filter(pk__in=input_clusters).values_list('id', flat=True)\n+            else:\n+                fields['clusters'] = GroupMember.objects.filter(user=request.user, group__in=input_clusters).values_list('group', flat=True)","path":"sigma_core/serializers/user.py","position":37,"original_position":37,"commit_id":"f5253023fb8006a9a7dacb912acb0b0f4f557017","original_commit_id":"f5253023fb8006a9a7dacb912acb0b0f4f557017","user":{"login":"tizot","id":8040983,"avatar_url":"https://avatars.githubusercontent.com/u/8040983?v=3","gravatar_id":"","url":"https://api.github.com/users/tizot","html_url":"https://github.com/tizot","followers_url":"https://api.github.com/users/tizot/followers","following_url":"https://api.github.com/users/tizot/following{/other_user}","gists_url":"https://api.github.com/users/tizot/gists{/gist_id}","starred_url":"https://api.github.com/users/tizot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tizot/subscriptions","organizations_url":"https://api.github.com/users/tizot/orgs","repos_url":"https://api.github.com/users/tizot/repos","events_url":"https://api.github.com/users/tizot/events{/privacy}","received_events_url":"https://api.github.com/users/tizot/received_events","type":"User","site_admin":false},"body":"Vérifier le perm_rank","created_at":"2016-02-12T07:55:23Z","updated_at":"2016-02-12T07:55:23Z","html_url":"https://github.com/ProjetSigma/backend/pull/24#discussion_r52713199","pull_request_url":"https://api.github.com/repos/ProjetSigma/backend/pulls/24","_links":{"self":{"href":"https://api.github.com/repos/ProjetSigma/backend/pulls/comments/52713199"},"html":{"href":"https://github.com/ProjetSigma/backend/pull/24#discussion_r52713199"},"pull_request":{"href":"https://api.github.com/repos/ProjetSigma/backend/pulls/24"}}},"pull_request":{"url":"https://api.github.com/repos/ProjetSigma/backend/pulls/24","id":59064208,"html_url":"https://github.com/ProjetSigma/backend/pull/24","diff_url":"https://github.com/ProjetSigma/backend/pull/24.diff","patch_url":"https://github.com/ProjetSigma/backend/pull/24.patch","issue_url":"https://api.github.com/repos/ProjetSigma/backend/issues/24","number":24,"state":"open","locked":false,"title":"Feature/130 cluster permissions","user":{"login":"TheBirdie","id":11926287,"avatar_url":"https://avatars.githubusercontent.com/u/11926287?v=3","gravatar_id":"","url":"https://api.github.com/users/TheBirdie","html_url":"https://github.com/TheBirdie","followers_url":"https://api.github.com/users/TheBirdie/followers","following_url":"https://api.github.com/users/TheBirdie/following{/other_user}","gists_url":"https://api.github.com/users/TheBirdie/gists{/gist_id}","starred_url":"https://api.github.com/users/TheBirdie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheBirdie/subscriptions","organizations_url":"https://api.github.com/users/TheBirdie/orgs","repos_url":"https://api.github.com/users/TheBirdie/repos","events_url":"https://api.github.com/users/TheBirdie/events{/privacy}","received_events_url":"https://api.github.com/users/TheBirdie/received_events","type":"User","site_admin":false},"body":"* Replace School model with Cluster model\r\n* Cluster admins can create users inside their cluster\r\n* Add a \"direct\" ManyToMany relation between User <-> Group through GroupMember object\r\n* Todo: fix redundancy between User.clusters and GroupMember (a user is attached to a Cluster twice ...)\r\n* Fixtures fix ?","created_at":"2016-02-11T17:21:41Z","updated_at":"2016-02-12T07:55:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9861edff0615004e4a00d7db9a610631abed3772","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ProjetSigma/backend/pulls/24/commits","review_comments_url":"https://api.github.com/repos/ProjetSigma/backend/pulls/24/comments","review_comment_url":"https://api.github.com/repos/ProjetSigma/backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ProjetSigma/backend/issues/24/comments","statuses_url":"https://api.github.com/repos/ProjetSigma/backend/statuses/f5253023fb8006a9a7dacb912acb0b0f4f557017","head":{"label":"ProjetSigma:feature/130-cluster-permissions","ref":"feature/130-cluster-permissions","sha":"f5253023fb8006a9a7dacb912acb0b0f4f557017","user":{"login":"ProjetSigma","id":14943240,"avatar_url":"https://avatars.githubusercontent.com/u/14943240?v=3","gravatar_id":"","url":"https://api.github.com/users/ProjetSigma","html_url":"https://github.com/ProjetSigma","followers_url":"https://api.github.com/users/ProjetSigma/followers","following_url":"https://api.github.com/users/ProjetSigma/following{/other_user}","gists_url":"https://api.github.com/users/ProjetSigma/gists{/gist_id}","starred_url":"https://api.github.com/users/ProjetSigma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProjetSigma/subscriptions","organizations_url":"https://api.github.com/users/ProjetSigma/orgs","repos_url":"https://api.github.com/users/ProjetSigma/repos","events_url":"https://api.github.com/users/ProjetSigma/events{/privacy}","received_events_url":"https://api.github.com/users/ProjetSigma/received_events","type":"Organization","site_admin":false},"repo":{"id":46338491,"name":"backend","full_name":"ProjetSigma/backend","owner":{"login":"ProjetSigma","id":14943240,"avatar_url":"https://avatars.githubusercontent.com/u/14943240?v=3","gravatar_id":"","url":"https://api.github.com/users/ProjetSigma","html_url":"https://github.com/ProjetSigma","followers_url":"https://api.github.com/users/ProjetSigma/followers","following_url":"https://api.github.com/users/ProjetSigma/following{/other_user}","gists_url":"https://api.github.com/users/ProjetSigma/gists{/gist_id}","starred_url":"https://api.github.com/users/ProjetSigma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProjetSigma/subscriptions","organizations_url":"https://api.github.com/users/ProjetSigma/orgs","repos_url":"https://api.github.com/users/ProjetSigma/repos","events_url":"https://api.github.com/users/ProjetSigma/events{/privacy}","received_events_url":"https://api.github.com/users/ProjetSigma/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ProjetSigma/backend","description":"Back-end of Projet Sigma","fork":false,"url":"https://api.github.com/repos/ProjetSigma/backend","forks_url":"https://api.github.com/repos/ProjetSigma/backend/forks","keys_url":"https://api.github.com/repos/ProjetSigma/backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ProjetSigma/backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ProjetSigma/backend/teams","hooks_url":"https://api.github.com/repos/ProjetSigma/backend/hooks","issue_events_url":"https://api.github.com/repos/ProjetSigma/backend/issues/events{/number}","events_url":"https://api.github.com/repos/ProjetSigma/backend/events","assignees_url":"https://api.github.com/repos/ProjetSigma/backend/assignees{/user}","branches_url":"https://api.github.com/repos/ProjetSigma/backend/branches{/branch}","tags_url":"https://api.github.com/repos/ProjetSigma/backend/tags","blobs_url":"https://api.github.com/repos/ProjetSigma/backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ProjetSigma/backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ProjetSigma/backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/ProjetSigma/backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ProjetSigma/backend/statuses/{sha}","languages_url":"https://api.github.com/repos/ProjetSigma/backend/languages","stargazers_url":"https://api.github.com/repos/ProjetSigma/backend/stargazers","contributors_url":"https://api.github.com/repos/ProjetSigma/backend/contributors","subscribers_url":"https://api.github.com/repos/ProjetSigma/backend/subscribers","subscription_url":"https://api.github.com/repos/ProjetSigma/backend/subscription","commits_url":"https://api.github.com/repos/ProjetSigma/backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/ProjetSigma/backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/ProjetSigma/backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/ProjetSigma/backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/ProjetSigma/backend/contents/{+path}","compare_url":"https://api.github.com/repos/ProjetSigma/backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ProjetSigma/backend/merges","archive_url":"https://api.github.com/repos/ProjetSigma/backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ProjetSigma/backend/downloads","issues_url":"https://api.github.com/repos/ProjetSigma/backend/issues{/number}","pulls_url":"https://api.github.com/repos/ProjetSigma/backend/pulls{/number}","milestones_url":"https://api.github.com/repos/ProjetSigma/backend/milestones{/number}","notifications_url":"https://api.github.com/repos/ProjetSigma/backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ProjetSigma/backend/labels{/name}","releases_url":"https://api.github.com/repos/ProjetSigma/backend/releases{/id}","deployments_url":"https://api.github.com/repos/ProjetSigma/backend/deployments","created_at":"2015-11-17T10:01:22Z","updated_at":"2016-02-04T22:00:53Z","pushed_at":"2016-02-11T23:06:15Z","git_url":"git://github.com/ProjetSigma/backend.git","ssh_url":"git@github.com:ProjetSigma/backend.git","clone_url":"https://github.com/ProjetSigma/backend.git","svn_url":"https://github.com/ProjetSigma/backend","homepage":null,"size":548,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"ProjetSigma:master","ref":"master","sha":"4635323fecec854e9369b26b87d2713c2dd7b182","user":{"login":"ProjetSigma","id":14943240,"avatar_url":"https://avatars.githubusercontent.com/u/14943240?v=3","gravatar_id":"","url":"https://api.github.com/users/ProjetSigma","html_url":"https://github.com/ProjetSigma","followers_url":"https://api.github.com/users/ProjetSigma/followers","following_url":"https://api.github.com/users/ProjetSigma/following{/other_user}","gists_url":"https://api.github.com/users/ProjetSigma/gists{/gist_id}","starred_url":"https://api.github.com/users/ProjetSigma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProjetSigma/subscriptions","organizations_url":"https://api.github.com/users/ProjetSigma/orgs","repos_url":"https://api.github.com/users/ProjetSigma/repos","events_url":"https://api.github.com/users/ProjetSigma/events{/privacy}","received_events_url":"https://api.github.com/users/ProjetSigma/received_events","type":"Organization","site_admin":false},"repo":{"id":46338491,"name":"backend","full_name":"ProjetSigma/backend","owner":{"login":"ProjetSigma","id":14943240,"avatar_url":"https://avatars.githubusercontent.com/u/14943240?v=3","gravatar_id":"","url":"https://api.github.com/users/ProjetSigma","html_url":"https://github.com/ProjetSigma","followers_url":"https://api.github.com/users/ProjetSigma/followers","following_url":"https://api.github.com/users/ProjetSigma/following{/other_user}","gists_url":"https://api.github.com/users/ProjetSigma/gists{/gist_id}","starred_url":"https://api.github.com/users/ProjetSigma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProjetSigma/subscriptions","organizations_url":"https://api.github.com/users/ProjetSigma/orgs","repos_url":"https://api.github.com/users/ProjetSigma/repos","events_url":"https://api.github.com/users/ProjetSigma/events{/privacy}","received_events_url":"https://api.github.com/users/ProjetSigma/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ProjetSigma/backend","description":"Back-end of Projet Sigma","fork":false,"url":"https://api.github.com/repos/ProjetSigma/backend","forks_url":"https://api.github.com/repos/ProjetSigma/backend/forks","keys_url":"https://api.github.com/repos/ProjetSigma/backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ProjetSigma/backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ProjetSigma/backend/teams","hooks_url":"https://api.github.com/repos/ProjetSigma/backend/hooks","issue_events_url":"https://api.github.com/repos/ProjetSigma/backend/issues/events{/number}","events_url":"https://api.github.com/repos/ProjetSigma/backend/events","assignees_url":"https://api.github.com/repos/ProjetSigma/backend/assignees{/user}","branches_url":"https://api.github.com/repos/ProjetSigma/backend/branches{/branch}","tags_url":"https://api.github.com/repos/ProjetSigma/backend/tags","blobs_url":"https://api.github.com/repos/ProjetSigma/backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ProjetSigma/backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ProjetSigma/backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/ProjetSigma/backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ProjetSigma/backend/statuses/{sha}","languages_url":"https://api.github.com/repos/ProjetSigma/backend/languages","stargazers_url":"https://api.github.com/repos/ProjetSigma/backend/stargazers","contributors_url":"https://api.github.com/repos/ProjetSigma/backend/contributors","subscribers_url":"https://api.github.com/repos/ProjetSigma/backend/subscribers","subscription_url":"https://api.github.com/repos/ProjetSigma/backend/subscription","commits_url":"https://api.github.com/repos/ProjetSigma/backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/ProjetSigma/backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/ProjetSigma/backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/ProjetSigma/backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/ProjetSigma/backend/contents/{+path}","compare_url":"https://api.github.com/repos/ProjetSigma/backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ProjetSigma/backend/merges","archive_url":"https://api.github.com/repos/ProjetSigma/backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ProjetSigma/backend/downloads","issues_url":"https://api.github.com/repos/ProjetSigma/backend/issues{/number}","pulls_url":"https://api.github.com/repos/ProjetSigma/backend/pulls{/number}","milestones_url":"https://api.github.com/repos/ProjetSigma/backend/milestones{/number}","notifications_url":"https://api.github.com/repos/ProjetSigma/backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ProjetSigma/backend/labels{/name}","releases_url":"https://api.github.com/repos/ProjetSigma/backend/releases{/id}","deployments_url":"https://api.github.com/repos/ProjetSigma/backend/deployments","created_at":"2015-11-17T10:01:22Z","updated_at":"2016-02-04T22:00:53Z","pushed_at":"2016-02-11T23:06:15Z","git_url":"git://github.com/ProjetSigma/backend.git","ssh_url":"git@github.com:ProjetSigma/backend.git","clone_url":"https://github.com/ProjetSigma/backend.git","svn_url":"https://github.com/ProjetSigma/backend","homepage":null,"size":548,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ProjetSigma/backend/pulls/24"},"html":{"href":"https://github.com/ProjetSigma/backend/pull/24"},"issue":{"href":"https://api.github.com/repos/ProjetSigma/backend/issues/24"},"comments":{"href":"https://api.github.com/repos/ProjetSigma/backend/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/ProjetSigma/backend/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/ProjetSigma/backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ProjetSigma/backend/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/ProjetSigma/backend/statuses/f5253023fb8006a9a7dacb912acb0b0f4f557017"}}}}