Skip to content

Commit

Permalink
Allow admins to update any profile.
Browse files Browse the repository at this point in the history
  • Loading branch information
dinoboff committed Aug 31, 2015
1 parent 7bb053f commit 5c08f40
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h2 flex>
<small> - registered as <em>{{profile.services[serviceId].details.name}}</em></small>
</h2>

<md-button class="md-icon-button" aria-label="remove service" ng-click="ctrl.remove(serviceId, profile.services[serviceId].details)" ng-if="ctrl.canUpdate()">
<md-button class="md-icon-button" aria-label="remove service" ng-click="ctrl.remove(serviceId, profile.services[serviceId].details)" ng-if="ctrl.canRemove()">
<md-icon md-svg-icon="highlight-remove"></md-icon>
</md-button>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/classmentors/components/profiles/profiles-view-show.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ <h3 ng-if="ctrl.profile.user.school" layout="row" layout-align="center center">
<div flex="67">

<div clm-spf-profile="ctrl.profile.$id"></div>
<div clm-profile="ctrl.profile" clm-service-id="codeCombat"></div>
<div clm-profile="ctrl.profile" clm-service-id="codeSchool"></div>
<div clm-profile="ctrl.profile" clm-service-id="treeHouse"></div>
<div clm-profile="ctrl.profile" clm-service-id="codeCombat" clm-current-user="ctrl.currentUserProfile"></div>
<div clm-profile="ctrl.profile" clm-service-id="codeSchool" clm-current-user="ctrl.currentUserProfile"></div>
<div clm-profile="ctrl.profile" clm-service-id="treeHouse" clm-current-user="ctrl.currentUserProfile"></div>

<div id="register-codecombat" ng-if="!ctrl.profile.services.codeCombat.details.id" class="register-service md-whiteframe-z1">
<h2>Code Combat</h2>
Expand Down
8 changes: 8 additions & 0 deletions src/classmentors/components/profiles/profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@
);
};

this.canRemove = function() {
return (
$scope.profile &&
$scope.currentUser &&
$scope.profile.$id === $scope.currentUser.$id
);
};

this.update = function() {
return clmDataStore.services[$scope.serviceId].updateProfile(
$scope.profile
Expand Down

0 comments on commit 5c08f40

Please sign in to comment.