diff --git a/endpoints/api.py b/endpoints/api.py index ef7d675de..0deadb9ae 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -298,8 +298,8 @@ def get_organization_team_members(orgname, teamname): if current_user.is_anonymous(): abort(404) - # TODO: determine whether the user has permission to view the team members of this team - # (i.e. they are a member of the team [maybe??] OR they are an admin of the org) + # TODO: determine whether the user has permission to view the members of this team + # (i.e. they are a member of the team OR they are an admin of the org) user = current_user.db_user() team = None @@ -309,8 +309,11 @@ def get_organization_team_members(orgname, teamname): abort(404) members = model.get_organization_team_members(team.id) + + # TODO: determine whether the user has permission to *edit* the members of this team. return jsonify({ - 'members': { m.username : member_view(m) for m in members } + 'members': { m.username : member_view(m) for m in members }, + 'can_edit': True }) diff --git a/static/js/controllers.js b/static/js/controllers.js index 6152bed9e..f04edb261 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -1179,6 +1179,18 @@ function NewRepoCtrl($scope, $location, $http, $timeout, UserService, Restangula function OrgViewCtrl($scope, Restangular, $routeParams) { var orgname = $routeParams.orgname; + + var loadOrganization = function() { + var getOrganization = Restangular.one(getRestUrl('organization', orgname)); + getOrganization.get().then(function(resp) { + $scope.organization = resp; + $scope.loading = false; + }, function() { + $scope.loading = false; + }); + }; + + loadOrganization(); } function OrgAdminCtrl($scope, Restangular, $routeParams) { @@ -1238,6 +1250,7 @@ function TeamViewCtrl($rootScope, $scope, Restangular, $routeParams) { var getMembers = Restangular.one(getRestUrl('organization', orgname, 'team', teamname, 'members')); getMembers.get().then(function(resp) { $scope.members = resp.members; + $scope.canEditMembers = resp.can_edit; $scope.loading = !$scope.organization || !$scope.members; $rootScope.title = teamname + ' (' + orgname + ')'; }, function() { diff --git a/static/partials/org-view.html b/static/partials/org-view.html new file mode 100644 index 000000000..83a2b8160 --- /dev/null +++ b/static/partials/org-view.html @@ -0,0 +1,11 @@ +