diff --git a/apis/client/lib/router.js b/apis/client/lib/router.js index e820e5b987..f0cb4639aa 100644 --- a/apis/client/lib/router.js +++ b/apis/client/lib/router.js @@ -1,3 +1,6 @@ +import { Meteor } from 'meteor/meteor'; +import { Router } from 'meteor/iron:router'; + Router.route('/api/new', function () { this.render('addApi'); this.layout('masterLayout'); @@ -19,13 +22,13 @@ Router.route('/api/:_id/', function () { // Get current API Backend ID const apiBackendId = Router.current().params._id; - // Ensure current user is authorized to view backend - Meteor.call('currentUserCanViewApi', apiBackendId, function (error, userIsAuthorized) { - if (userIsAuthorized) { + // Ensure current user has permissions to view backend + Meteor.call('currentUserCanViewApi', apiBackendId, (error, userIsAllowedToViewApi) => { + if (userIsAllowedToViewApi) { route.render('viewApi'); route.layout('masterLayout'); } else { - Router.go('notAuthorized'); + Router.go('forbidden'); } }); }, { diff --git a/apis/client/view/header/header.html b/apis/client/view/header/header.html index a86c981a87..ce3e956414 100644 --- a/apis/client/view/header/header.html +++ b/apis/client/view/header/header.html @@ -8,6 +8,9 @@

{{ api.name }} {{> viewApiStatus api=api width="0.4" }}

+ {{# unless api.isPublic }} + private + {{/ unless }} - {{# if api.currentUserCanEdit }} + {{# if api.currentUserCanView }} {{> apiIntro }} {{/ if }} diff --git a/apis/client/view/header/header.less b/apis/client/view/header/header.less index d5f46fb2ff..bcee3b22af 100644 --- a/apis/client/view/header/header.less +++ b/apis/client/view/header/header.less @@ -12,14 +12,19 @@ border-bottom: 1px solid #eee; #api-header { + display: inline; font-size: 1.7em; font-weight: 600; padding-left: 0.5em; - margin-left: 2em; + margin-left: 0em; margin-bottom: 0; margin-top: 0.1em; } + .label-align { + vertical-align: text-top; + } + .view-api-meta-details { padding-left: 0.5em; margin-left: 3.4em; diff --git a/apis/collection/helpers.js b/apis/collection/helpers.js index 93726c76ce..9f90b811ff 100644 --- a/apis/collection/helpers.js +++ b/apis/collection/helpers.js @@ -20,11 +20,14 @@ Apis.helpers({ // Check if user is manager of this API const userIsManager = _.includes(this.managerIds, userId); + // Check if user has external access + const userIsAuthorized = _.includes(this.authorizedUserIds, userId); + // Check if user is administrator const userIsAdmin = Roles.userIsInRole(userId, ['admin']); // if user is manager or administrator, they can edit - if (userIsManager || userIsAdmin) { + if (userIsManager || userIsAuthorized || userIsAdmin) { return true; } } diff --git a/apis_authorization/client/list/list.html b/apis_authorization/client/list/list.html index 79008c7871..32b154df0d 100644 --- a/apis_authorization/client/list/list.html +++ b/apis_authorization/client/list/list.html @@ -2,7 +2,9 @@

{{_ 'apiAuthorizedUsersList_ header_text' }}

- +

+ {{_ 'apiSettings_visibility_authorizedUsers'}} +