{"action":"created","issue":{"url":"https://api.github.com/repos/code-corps/code-corps-api/issues/114","labels_url":"https://api.github.com/repos/code-corps/code-corps-api/issues/114/labels{/name}","comments_url":"https://api.github.com/repos/code-corps/code-corps-api/issues/114/comments","events_url":"https://api.github.com/repos/code-corps/code-corps-api/issues/114/events","html_url":"https://github.com/code-corps/code-corps-api/pull/114","id":121375551,"number":114,"title":"Add project policy","user":{"login":"scarfdestroyer","id":15225519,"avatar_url":"https://avatars.githubusercontent.com/u/15225519?v=3","gravatar_id":"","url":"https://api.github.com/users/scarfdestroyer","html_url":"https://github.com/scarfdestroyer","followers_url":"https://api.github.com/users/scarfdestroyer/followers","following_url":"https://api.github.com/users/scarfdestroyer/following{/other_user}","gists_url":"https://api.github.com/users/scarfdestroyer/gists{/gist_id}","starred_url":"https://api.github.com/users/scarfdestroyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scarfdestroyer/subscriptions","organizations_url":"https://api.github.com/users/scarfdestroyer/orgs","repos_url":"https://api.github.com/users/scarfdestroyer/repos","events_url":"https://api.github.com/users/scarfdestroyer/events{/privacy}","received_events_url":"https://api.github.com/users/scarfdestroyer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/code-corps/code-corps-api/labels/awaiting%20review","name":"awaiting review","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-10T00:44:09Z","updated_at":"2015-12-10T07:58:00Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/code-corps/code-corps-api/pulls/114","html_url":"https://github.com/code-corps/code-corps-api/pull/114","diff_url":"https://github.com/code-corps/code-corps-api/pull/114.diff","patch_url":"https://github.com/code-corps/code-corps-api/pull/114.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/code-corps/code-corps-api/issues/comments/163527684","html_url":"https://github.com/code-corps/code-corps-api/pull/114#issuecomment-163527684","issue_url":"https://api.github.com/repos/code-corps/code-corps-api/issues/114","id":163527684,"user":{"login":"begedin","id":1925540,"avatar_url":"https://avatars.githubusercontent.com/u/1925540?v=3","gravatar_id":"","url":"https://api.github.com/users/begedin","html_url":"https://github.com/begedin","followers_url":"https://api.github.com/users/begedin/followers","following_url":"https://api.github.com/users/begedin/following{/other_user}","gists_url":"https://api.github.com/users/begedin/gists{/gist_id}","starred_url":"https://api.github.com/users/begedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/begedin/subscriptions","organizations_url":"https://api.github.com/users/begedin/orgs","repos_url":"https://api.github.com/users/begedin/repos","events_url":"https://api.github.com/users/begedin/events{/privacy}","received_events_url":"https://api.github.com/users/begedin/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T07:58:00Z","updated_at":"2015-12-10T07:58:00Z","body":"I don't think this is the policy we need. That being said, I'm also not completely sure what it should be.\r\n\r\n`user.admin?` is not something we generally look at for policies. Admins are just special types of users that do special stuff in the system.\r\n\r\nIn this case, I believe we should have two general cases.\r\n\r\n* If the project.owner is a user, then it needs to be the current user, because a user can define projects of their own.\r\n* If the project owner is a team, then \r\n  * The user needs to belong to the team and be able to define projects for that team. This should depend on their role in the team, so `user.team_memberships.find_by!(team).role`. The problem is, there is currently no such thing as a membership role in our `team_memberships` table.\r\n  * If the user does not belong to the team, it's possible they could belong to the organization who owns the team, and they could have a role in the organization which would still allow them to define projects for that team. Again, this isn't something we have the database for right now. The `organization_memberships` table would require a column for it.\r\n"}}