0.0.68 • Published 7 years ago

admin-engine-addon v0.0.68

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

Admin Engine Addon

This README outlines the details of collaborating on this Ember addon.

This addon is to be used with the sails.js generator found on npm as admin.rest.ember.generator. Please visit the npm page to install it and run it on your sails js server.

Before proceeding with this engine installation, please visit the ember-engine github page on this link: https://github.com/dgeb/ember-engines/tree/v0.3 and ember install ember-engines@0.3.0

Then set up the app.js file as follows:

import Ember from 'ember';
import Resolver from 'ember-engines/resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

let App;

Ember.MODEL_FACTORY_INJECTIONS = true;

App = Ember.Application.extend({
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix,
  Resolver,
  engines: {
    adminEngineAddon: {
      dependencies: {
        services: [
          'session', 'store', 'current-user', 'app-config', 'permission-check'
        ]
      }
    }
  }

});

loadInitializers(App, config.modulePrefix);

export default App;

Then go to the terminal and install admin-engine-addon like so:

ember install admin-engine-addon

Then go ahead and copy into the root the .env file, or create it and copy the following content:

ZURU_API_URL='http://localhost:1337/api/v1'
SERVER_TOKEN_ENDPOINT='http://localhost:1337/api/v1/auths/login?type=local'
SERVER_TOKEN_REFRESH_ENDPOINT='http://localhost:1337/api/v1/users/jwt'
ENABLE_AUTH_PROXY=true

Then set up the app config file with the following addition configurations add override the setting as necessary. Take note that a bundled addon 'admin-lte-app-shares' already has the same settings:

ENV['zuru'] = {
  apiUrl: process.env.ZURU_API_URL,
  enableAuthProxy: process.env.ENABLE_AUTH_PROXY
}

ENV['ember-simple-auth-token'] = {
  refreshAccessTokens: true,
  tokenExpireName: 'exp',
  timeFactor: 1,
  refreshLeeway: 300, //Refresh the token 5 minutes (300s) before it expires
  identificationField: 'email',
  tokenPropertyName: 'access_token',
  serverTokenEndpoint: process.env.SERVER_TOKEN_ENDPOINT,
  serverTokenRefreshEndpoint: process.env.SERVER_TOKEN_REFRESH_ENDPOINT
};
ENV['ember-simple-auth'] = {
  authenticationRoute: 'admin.access.login',
  routeAfterAuthentication: 'security.admin.tasks',
  routeIfAlreadyAuthenticated: 'admin.tasks'
};

And then go to the router.js file and set up the following mount:

Router.map(function () {
  this.mount('admin-engine-addon', { as: 'security' });
});

Notice that inside the mount the alias used by default for this is 'security'. If you change it, be sure to go back into the config and change the default access login paths with new alias.

Also, added the ember-can authorisation library. Please visit the ember-can github page on this link: https://github.com/minutebase/ember-can

To limit the view within the template, use the following format:

{{#if (can 'view resource' (hash permission='canSee' resource='Resources' ))}}
{{/if}}

The first part '(can 'view resource') is for finding the ability class of 'resource' and calling the computed property 'can view' camel cased. The second part of '(hash permission='canSee' resource='Resources' )' is the model that will be passed on to the ability class. They are used to filter the permissions collection on the server by the resource model name and permission field on the permission object.

Installation

  • git clone <repository-url> this repository
  • cd admin.engine.addon
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://ember-cli.com/.

0.0.68

7 years ago

0.0.67

7 years ago

0.0.66

7 years ago

0.0.65

7 years ago

0.0.64

7 years ago

0.0.63

7 years ago

0.0.62

7 years ago

0.0.61

7 years ago

0.0.59

7 years ago

0.0.58

7 years ago

0.0.57

7 years ago

0.0.56

7 years ago

0.0.55

7 years ago

0.0.53

8 years ago

0.0.52

8 years ago

0.0.51

8 years ago

0.0.50

8 years ago

0.0.49

8 years ago

0.0.48

8 years ago

0.0.47

8 years ago

0.0.46

8 years ago

0.0.45

8 years ago

0.0.44

8 years ago

0.0.43

8 years ago

0.0.42

8 years ago

0.0.41

8 years ago

0.0.40

8 years ago

0.0.39

8 years ago

0.0.38

8 years ago

0.0.37

8 years ago

0.0.36

8 years ago

0.0.35

8 years ago

0.0.34

8 years ago

0.0.33

8 years ago

0.0.32

8 years ago

0.0.31

8 years ago

0.0.30

8 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27

8 years ago