Skip to content

Commit

Permalink
Merge pull request #3606 from apinf/develop
Browse files Browse the repository at this point in the history
release 0.56.3 merge to master
  • Loading branch information
ilarimikkonen committed Oct 29, 2018
2 parents 3f91932 + 43207bd commit f9ad3c7
Show file tree
Hide file tree
Showing 26 changed files with 489 additions and 97 deletions.
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ natestrauser:select2
meteorhacks:aggregate
apinf:api-umbrella
apinf:accounts-admin-ui
oauth
2 changes: 1 addition & 1 deletion .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ apinf:autoform-bs-datepicker@1.1.2
apinf:bootstrap@3.3.7
apinf:create-role-if-undefined@0.1.1
apinf:first-admin@0.1.2
apinf:fiware@0.1.3
apinf:fiware@0.2.0
apinf:restivus-swagger@0.4.0
aramk:quill@0.1.1
arillo:flow-router-helpers@0.5.2
Expand Down
2 changes: 1 addition & 1 deletion .scripts/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2017 Apinf Oy
# Copyright 2018 Apinf Oy
#This file is covered by the EUPL license.
#You may obtain a copy of the licence at
#https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
- docker

before_install:
- free -m
- pwd
- ls -la
# Install meteor locally on CI
Expand Down
6 changes: 3 additions & 3 deletions apinf_packages/about/client/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ <h3>
Apinf
</dt>
<dd>
0.56.0
0.56.3
</dd>
<dt>
API Umbrella
</dt>
<dd>
0.15
0.15.0-apinf2.1
</dd>
<dt>
Version
Expand Down Expand Up @@ -134,7 +134,7 @@ <h3>
{{_ "aboutApinf_contributors" }}
</dt>
<dd>
Jawid Ahmadi, Taija Björklund, Vesa Härkönen, Nazia Hasan, Ville Jyrkkä, Matti Leppänen, Philippe Luickx, Ilari Mikkonen, Jarkko Moilanen, Alapan Mukherjee, Damir Mustafin, Sridevi Nittoor, Illya Nizyev, Yan Nunes, Brylie Christopher Oxley, Sebastian Pancia, Massimo Rangoni, Saransh Dev Singh, Shalva Usubov, Juuso Vallius, Sarala Vanipenta, Cassiano Vellames, Maurício Vieira, Daria Voytova
Jawid Ahmadi, Taija Björklund, Vesa Härkönen, Nazia Hasan, Ville Jyrkkä, Matti Leppänen, Philippe Luickx, Ilari Mikkonen, Jarkko Moilanen, Alapan Mukherjee, Damir Mustafin, Sridevi Nittoor, Illya Nizyev, Yan Nunes, Brylie Christopher Oxley, Sebastian Pancia, Massimo Rangoni, Vinay Sanker, Saransh Dev Singh, Shalva Usubov, Juuso Vallius, Sarala Vanipenta, Cassiano Vellames, Maurício Vieira, Daria Voytova
</dd>
<dt>
{{_ "aboutApinf_openSource" }}
Expand Down
10 changes: 5 additions & 5 deletions apinf_packages/apis/client/lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ FlowRouter.route('/apis/:slug/', {
rel: 'alternate',
type: 'application/rss+xml',
href: `/rss/apis/?slug=${slug}`,
title: `RSS Feed for ${api.name}`,
// title: `RSS Feed for ${api.name}`,
});
}

// Set Social Meta Tags
// Facebook & LinkedIn
DocHead.addMeta({ property: 'og:image', content: api.logoUrl });
DocHead.addMeta({ property: 'og:title', content: api.name });
DocHead.addMeta({ property: 'og:description', content: api.description });
// DocHead.addMeta({ property: 'og:title', content: api.name });
// DocHead.addMeta({ property: 'og:description', content: api.description });
DocHead.addMeta({ property: 'og:url', content: window.location.href });
// Twitter
DocHead.addMeta({ property: 'twitter:card', content: 'summary' });
DocHead.addMeta({ property: 'twitter:title', content: api.name });
DocHead.addMeta({ property: 'twitter:description', content: api.description });
// DocHead.addMeta({ property: 'twitter:title', content: api.name });
// DocHead.addMeta({ property: 'twitter:description', content: api.description });
DocHead.addMeta({ property: 'twitter:image', content: api.logoUrl });

// Ensure current user has permissions to view backend
Expand Down
13 changes: 7 additions & 6 deletions apinf_packages/apis/server/methods/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence

// Meteor packages imports
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { Match, check } from 'meteor/check';

// Collection imports
import Apis from '/apinf_packages/apis/collection';
Expand All @@ -18,18 +18,19 @@ Meteor.publish('getApiStatusRecordData', (apiId) => {
const startDate = new Date();
const lastDate = new Date();
lastDate.setDate(lastDate.getDate() - 1);
const query = { responses: { $elemMatch: { date: { $gte: startDate, $lte: lastDate } } } };
const query = { responses: { $elemMatch: { date: { $gte: lastDate, $lte: startDate } } } };
return MonitoringData.find({ apiId }, query);
});

Meteor.methods({
getApiStatus (apiId, url) {
getApiStatus (apiId, url, endPoint) {
// Make sure apiId is a string
check(apiId, String);

// Make sure url is a string
check(url, String);

// Make sure endPoint is a String
// eslint-disable-next-line new-cap
check(endPoint, Match.Maybe(String));
// Call HTTP request
Meteor.http.get(url, {}, (error, result) => {
// Set status code
Expand All @@ -39,9 +40,9 @@ Meteor.methods({
const monitoringData = {
date: new Date(),
server_status_code: serverStatusCode,
end_point: endPoint,
};


// Update an api status
Apis.update(apiId, { $set: { latestMonitoringStatusCode: serverStatusCode } });

Expand Down
17 changes: 16 additions & 1 deletion apinf_packages/core/helper_functions/validate_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function githubSettingsValid (LoginPlatforms) {
export function fiwareSettingsValid (LoginPlatforms) {
// Verifies if LoginPlatforms exists and if it has the fiwareConfiguration property
if ((typeof LoginPlatforms !== 'undefined') && LoginPlatforms.fiwareConfiguration) {
// Assigns object referece to variable for better readability
// Assigns object reference to variable for better readability
const fiwareConfiguration = LoginPlatforms.fiwareConfiguration;
// Verifies if fiwareConfiguration property has clientId, rootURL and secret
if (fiwareConfiguration.clientId && fiwareConfiguration.secret && fiwareConfiguration.rootURL) {
Expand All @@ -33,6 +33,21 @@ export function fiwareSettingsValid (LoginPlatforms) {
return false;
}

// Validates OIDC configuration on LoginPlatforms
export function oidcSettingsValid (LoginPlatforms) {
// Verifies if LoginPlatforms exists and if it has the fiwareConfiguration property
if ((typeof LoginPlatforms !== 'undefined') && LoginPlatforms.oidcConfiguration) {
// Verifies if oidcConfiguration property has clientId and secret
if (LoginPlatforms.oidcConfiguration.clientId &&
LoginPlatforms.oidcConfiguration.secret) {
// returns true if get to this point. It has all the required fields
return true;
}
}
// Returns false if LoginPlatforms does not have all the required fields
return false;
}

// Validates mail configuration settings
export function mailSettingsValid (settings) {
if ((typeof settings !== 'undefined') && settings.mail && settings.mail.enabled) {
Expand Down
3 changes: 3 additions & 0 deletions apinf_packages/core/lib/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@
"invalidEmailMessage": "Must be a valid e-mail address",
"invalidProxyBasePathMessage": "Must begin and end with /. Allowed alphanumeric characters and -.?$*+'()/:#@!&,;=",
"invalidApiBasePathMessage": "Must begin and end with /. Allowed alphanumeric characters and -.?$*+'()/:#@!&,;=",
"invalidApiMonitoringEndpointMessage": "Must begin with /. Allowed alphanumeric characters and -.?$*+'()/:#@!&,;=",
"invalidApiRequiredMessage": "Invalid input not allowed",
"invalidContactPhoneMessage": "Must be a valid number. (0-9), +, -, space, / are allowed",
"latestApiBackends_Heading": "Latest APIs",
Expand Down Expand Up @@ -1186,8 +1187,10 @@
"settings_mail_toEmail": "This email is used for receiving contact form submissions. It needs to be a valid, pre-existing, domain-specific email",
"settings_github": "Github",
"settings_fiware": "FIWARE",
"settings_hsl": "HSL",
"settings_save": "Save",
"settings_development_features": "Enable development features",
"settings_disabled_login_methods": "Disabled login methods",
"settings_sdkCode_generator": "SDK Code Generator",
"settings_successMessage": "Settings saved",
"settings_errorMessage": "Invalid Settings! Something is not right or a field is missing.",
Expand Down
8 changes: 8 additions & 0 deletions apinf_packages/core/lib/simple_schema_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import {
apiRequiredHeaderRegEx,
proxyBasePathRegEx,
} from '/apinf_packages/proxy_backends/collection/regex';
import {
apiMonitoringEndpointRegEx,
apiEndPointRegEx,
} from '/apinf_packages/monitoring/collection/lib/regex';
import contactPhone from '/apinf_packages/organizations/collection/regex';

const invalidUrlMessage = TAPi18n.__('invalidUrlMessage');
Expand All @@ -23,6 +27,8 @@ const invalidProxyBasePathMessage = TAPi18n.__('invalidProxyBasePathMessage');
const invalidApiBasePathMessage = TAPi18n.__('invalidApiBasePathMessage');
const invalidApiRequiredMessage = TAPi18n.__('invalidApiRequiredMessage');
const invalidContactPhoneMessage = TAPi18n.__('invalidContactPhoneMessage');
const invalidApiMonitoringEndpointMessage = TAPi18n.__('invalidApiMonitoringEndpointMessage');
const invalidApiEndpointMessage = TAPi18n.__('invalidApiEndpointMessage');

SimpleSchema.messages({
regEx: [
Expand All @@ -35,5 +41,7 @@ SimpleSchema.messages({
{ exp: apiBasePathRegEx, msg: invalidApiBasePathMessage },
{ exp: apiRequiredHeaderRegEx, msg: invalidApiRequiredMessage },
{ exp: contactPhone, msg: invalidContactPhoneMessage },
{ exp: apiEndPointRegEx, msg: invalidApiEndpointMessage },
{ exp: apiMonitoringEndpointRegEx, msg: invalidApiMonitoringEndpointMessage },
],
});
15 changes: 15 additions & 0 deletions apinf_packages/login_platforms/client/login_platforms.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ <h3 class="panel-title">
{{> afQuickField name='githubConfiguration.secret' id="github-secret" }}
</div>
</div>
<!--div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
{{_ "settings_hsl" }}
</h3>
</div>
<div class="panel-body">
{{> afQuickField name='hslConfiguration.clientId' id="hsl-id" }}
{{> afQuickField name='hslConfiguration.secret' id="hsl-secret" }}
{{> afQuickField name='hslConfiguration.serverUrl' id="hsl-server" }}
{{> afQuickField name='hslConfiguration.authorizationEndpoint' id="hsl-authEp" }}
{{> afQuickField name='hslConfiguration.tokenEndpoint' id="hsl-tokenEp" }}
{{> afQuickField name='hslConfiguration.userinfoEndpoint' id="hsl-uInfoEp" }}
</div>
</div-->
<div id="form-buttons">
<button
type="submit"
Expand Down
24 changes: 24 additions & 0 deletions apinf_packages/login_platforms/client/login_platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { Template } from 'meteor/templating';
// Meteor contributed packages imports
import { DocHead } from 'meteor/kadira:dochead';
import { TAPi18n } from 'meteor/tap:i18n';
import { sAlert } from 'meteor/juliancwirko:s-alert';

// Meteor contributed packages imports
import promisifyCall from '/apinf_packages/core/helper_functions/promisify_call';

// Collection imports
import Branding from '/apinf_packages/branding/collection';
Expand All @@ -26,6 +30,26 @@ Template.loginPlatforms.onCreated(function () {
DocHead.setTitle(`${branding.siteTitle} - ${pageTitle}`);
}
});
// Check if there is some changes in Configuration
// If there are, update the LoginPlatform
promisifyCall('updateLoginPlatformsFromConfiguration')
.then(result => {
if (result) {
// Get settings form success message translation
const message = TAPi18n.__('settings_successMessage');
// Alert the user of successful save
sAlert.success(message);
}
})
.catch(err => {
if (err) {
// Get settings form success message translation
const message = TAPi18n.__('settings_errorMessage');
// Alert the user of successful save
sAlert.error(message, { timeout: 'none' });
}
});

// Subscription to feedback collection
instance.subscribe('loginPlatforms');
});
Expand Down
54 changes: 50 additions & 4 deletions apinf_packages/login_platforms/collection/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ LoginPlatforms.schema = new SimpleSchema({
},
'githubConfiguration.clientId': {
type: String,
optional: true,
optional: false,
autoform: {
placeholder: 'xxx',
},
},
'githubConfiguration.secret': {
type: String,
optional: true,
optional: false,
autoform: {
placeholder: 'xxx',
},
Expand All @@ -35,25 +35,71 @@ LoginPlatforms.schema = new SimpleSchema({
},
'fiwareConfiguration.clientId': {
type: String,
optional: true,
optional: false,
autoform: {
placeholder: 'xxx',
},
},
'fiwareConfiguration.secret': {
type: String,
optional: true,
optional: false,
autoform: {
placeholder: 'xxx',
},
},
'fiwareConfiguration.rootURL': {
type: String,
optional: false,
autoform: {
placeholder: 'xxx',
},
},
hslConfiguration: {
type: Object,
optional: true,
},
'hslConfiguration.clientId': {
type: String,
optional: false,
autoform: {
placeholder: 'xxx',
},
},
'hslConfiguration.secret': {
type: String,
optional: false,
autoform: {
placeholder: 'xxx',
},
},
'hslConfiguration.serverUrl': {
type: String,
optional: false,
autoform: {
placeholder: 'https://secure-server.fi',
},
},
'hslConfiguration.authorizationEndpoint': {
type: String,
optional: false,
autoform: {
placeholder: '/auth',
},
},
'hslConfiguration.tokenEndpoint': {
type: String,
optional: false,
autoform: {
placeholder: '/token',
},
},
'hslConfiguration.userinfoEndpoint': {
type: String,
optional: false,
autoform: {
placeholder: '/userInfo',
},
},
});

// Enable translations (i18n)
Expand Down

0 comments on commit f9ad3c7

Please sign in to comment.