@ -65,7 +65,7 @@ class ProjectTestCase(BaseTestCase): | |||||
def test_it_adds_team_member(self): | def test_it_adds_team_member(self): | ||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
form = {"invite_team_member": "1", "email": "[email protected]"} | |||||
form = {"invite_team_member": "1", "email": "[email protected]", "rw": "1"} | |||||
r = self.client.post(self.url, form) | r = self.client.post(self.url, form) | ||||
self.assertEqual(r.status_code, 200) | self.assertEqual(r.status_code, 200) | ||||
@ -76,6 +76,9 @@ class ProjectTestCase(BaseTestCase): | |||||
project=self.project, user__email="[email protected]" | project=self.project, user__email="[email protected]" | ||||
) | ) | ||||
# The read-write flag should be set | |||||
self.assertTrue(member.rw) | |||||
# The new user should not have their own project | # The new user should not have their own project | ||||
self.assertFalse(member.user.project_set.exists()) | self.assertFalse(member.user.project_set.exists()) | ||||
@ -86,6 +89,20 @@ class ProjectTestCase(BaseTestCase): | |||||
) | ) | ||||
self.assertHTMLEqual(mail.outbox[0].subject, subj) | self.assertHTMLEqual(mail.outbox[0].subject, subj) | ||||
def test_it_adds_readonly_team_member(self): | |||||
self.client.login(username="[email protected]", password="password") | |||||
form = {"invite_team_member": "1", "email": "[email protected]"} | |||||
r = self.client.post(self.url, form) | |||||
self.assertEqual(r.status_code, 200) | |||||
member = Member.objects.get( | |||||
project=self.project, user__email="[email protected]" | |||||
) | |||||
# The new user should not have their own project | |||||
self.assertFalse(member.rw) | |||||
def test_it_adds_member_from_another_team(self): | def test_it_adds_member_from_another_team(self): | ||||
# With team limit at zero, we should not be able to invite any new users | # With team limit at zero, we should not be able to invite any new users | ||||
self.profile.team_limit = 0 | self.profile.team_limit = 0 | ||||
@ -162,15 +162,21 @@ | |||||
<td>Owner</td> | <td>Owner</td> | ||||
<td></td> | <td></td> | ||||
</tr> | </tr> | ||||
{% for user in project.team %} | |||||
{% for m in project.member_set.all %} | |||||
<tr> | <tr> | ||||
<td class="email">{{ user.email }}</td> | |||||
<td>Member</td> | |||||
<td class="email">{{ m.user.email }}</td> | |||||
<td> | |||||
{% if m.rw %} | |||||
Member | |||||
{% else %} | |||||
Read-only | |||||
{% endif %} | |||||
</td> | |||||
<td> | <td> | ||||
{% if is_owner %} | {% if is_owner %} | ||||
<a | <a | ||||
href="#" | href="#" | ||||
data-email="{{ user.email }}" | |||||
data-email="{{ m.user.email }}" | |||||
class="pull-right member-remove">Remove</a> | class="pull-right member-remove">Remove</a> | ||||
{% endif %} | {% endif %} | ||||
</td> | </td> | ||||
@ -378,9 +384,10 @@ | |||||
<li>Team Members can create and manage Checks and Integrations</li> | <li>Team Members can create and manage Checks and Integrations</li> | ||||
<li>Only the project owner (you) can view and edit billing settings</li> | <li>Only the project owner (you) can view and edit billing settings</li> | ||||
</ul> | </ul> | ||||
<br /> | |||||
<div class="form-group"> | <div class="form-group"> | ||||
<label for="itm-email" class="col-sm-2 control-label">Email</label> | |||||
<div class="col-sm-9"> | |||||
<label for="itm-email" class="col-sm-3 control-label">Email</label> | |||||
<div class="col-sm-8"> | |||||
<input | <input | ||||
type="email" | type="email" | ||||
class="form-control" | class="form-control" | ||||
@ -390,6 +397,37 @@ | |||||
placeholder="[email protected]"> | placeholder="[email protected]"> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="form-group"> | |||||
<label class="col-sm-3 control-label">Access Level</label> | |||||
<div class="col-sm-8"> | |||||
<label class="radio-container"> | |||||
<input | |||||
type="radio" | |||||
name="rw" | |||||
value="1" | |||||
checked> | |||||
<span class="radiomark"></span> | |||||
Team Member | |||||
</label> | |||||
<label class="radio-container"> | |||||
<input | |||||
type="radio" | |||||
name="rw" | |||||
value=""> | |||||
<span class="radiomark"></span> | |||||
Read-only | |||||
<span class="help-block"> | |||||
Cannot modify checks or integrations. | |||||
Cannot access project's API keys. | |||||
</span> | |||||
</label> | |||||
</div> | |||||
</div> | |||||
</div> | </div> | ||||
<div class="modal-footer"> | <div class="modal-footer"> | ||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> | <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> | ||||