1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 20:15:26 +02:00

implemented edition license checks

This commit is contained in:
Harvey Kandola 2017-02-23 16:39:23 -08:00
parent edccb39019
commit a4e3264e0c
19 changed files with 146 additions and 19 deletions

View file

@ -10,6 +10,18 @@
// https://documize.com
import Ember from 'ember';
import NotifierMixin from '../../mixins/notifier';
export default Ember.Component.extend({
const {
inject: { service }
} = Ember;
export default Ember.Component.extend(NotifierMixin, {
appMeta :service(),
didRender() {
if (this.get('appMeta').invalidLicense()) {
this.showNotification(`!! Expired or invalid license !!`);
}
}
});

View file

@ -27,9 +27,15 @@ export default Ember.Service.extend({
title: '',
version: '',
message: '',
edition: 'Community',
valid: true,
allowAnonymousAccess: false,
setupMode: false,
invalidLicense() {
return this.valid === false;
},
getBaseUrl(endpoint) {
return [this.get('endpoint'), endpoint].join('/');
},

View file

@ -54,7 +54,7 @@ export default Ember.Service.extend({
}
},
// Saves product license
// Saves product license.
saveLicense(license) {
if(this.get('sessionService.isGlobalAdmin')) {
return this.get('ajax').request(`global/license`, {

View file

@ -42,7 +42,7 @@
<div class="input-control">
<label>License</label>
<div class="tip">XML format accepted</div>
{{textarea value=model.license rows="5"}}
{{textarea value=model.license rows="15"}}
</div>
<div class="regular-button button-blue" {{ action 'saveLicense' }}>save</div>
</form>

View file

@ -63,9 +63,22 @@ function isAjaxNotFoundError(reason) {
return false;
}
function isInvalidLicenseError(reason) {
if (typeof reason === "undefined" || typeof reason.errors === "undefined") {
return false;
}
if (reason.errors.length > 0 && reason.errors[0].status === "402") {
return true;
}
return false;
}
export default {
getSubdomain,
getAppUrl,
isAjaxAccessError,
isAjaxNotFoundError,
isInvalidLicenseError,
};

View file

@ -1,6 +1,6 @@
{
"name": "documize",
"version": "0.42.0",
"version": "0.43.0",
"description": "The Document IDE",
"private": true,
"repository": "",