Skip to content

Commit

Permalink
Merge 3cedfa0 into a3bdd66
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeiser committed Aug 13, 2020
2 parents a3bdd66 + 3cedfa0 commit a881663
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/litmos/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ def leaders(self):
)
)

def admins(self):
return User._parse_response(
API.get_sub_resource(
self.__class__.name(),
self.Id,
'admins'
)
)

def courses(self):
return Course._parse_response(
API.get_sub_resource(
self.__class__.name(),
self.Id,
'courses'
)
)

def add_sub_team(self, sub_team):
schema = copy(self.SCHEMA)
for param in schema:
Expand Down Expand Up @@ -113,6 +131,22 @@ def demote_team_leader(self, user):
user.Id
)

def promote_team_admin(self, user):
return API.update_sub_resource(
self.__class__.name(),
self.Id,
'admins',
user.Id
)

def demote_team_admin(self, user):
return API.remove_sub_resource(
self.__class__.name(),
self.Id,
'admins',
user.Id
)

def assign_courses(self, courses):
course_list = []
for course in courses:
Expand Down
9 changes: 9 additions & 0 deletions src/litmos/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ def deactivate(self):
self.Active = False
return self.save()

def teams(self):
return Team._parse_response(
API.get_sub_resource(
self.__class__.name(),
self.Id,
'teams'
)
)

def set_manager(self, manager):
if type(manager)==User:
self.ManagerId = manager.Id
Expand Down

0 comments on commit a881663

Please sign in to comment.