Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
ember-admin
Advanced tools
Automatically discover your models and interact with all model data in a simple CRUD interface. Great for a drop-in starter admin backend.
EmberAdmin uses its own data store so as not to pull in data it shouldn't into your regular data store.
EmberData is currently a requirement.
npm install ember-admin --save-dev
Add the admin routes to your router.js
import adminRouter from 'ember-admin/router';
Router.map(function() {
adminRouter(this);
});
Start your ember-cli project and navigate to /admin
.
By default EmberAdmin is unrestricted. If you'd like to restrict access
you should override the admin
route app/routes/admin.js
import Ember from 'ember';
import EmberAdminRouteAdmin from 'ember-admin/routes/admin';
export default EmberAdminRouteAdmin.extend({
});
Now you can extend the Route to behave however you'd like.
Note: you should always take care to ensure that your backend API used by EmberAdmin is properly restricted to authorized users.
EmberAdmin expects as a default to access all of your models under an admin/
namespaced API. EmberAdmin will take the adapter for your model and
append admin
to the current namespace. So if your Dog
model's URL is typically:
/api/dogs
EmberAdmin will try /api/admin/dogs
. You will need to
provide the following backend API endpoints:
[GET] /admin/:model
[POST] /admin/:model
[PUT] /admin/:model/:id
[DELETE] /admin/:model/:id
By default EmberAdmin will serve up its own templates that are pretty generic. You can override the following template paths:
app/templates/admin.hbs
- landing page for admin interfaceapp/templates/admin/index/default.hbs
- lists all records for a
given modelapp/templates/admin/edit/default.hbs
- edit form for a given recordapp/templates/admin/new/default.hbs
- form for creating a new recordThe above templates will apply to all models. If you want to have forms that apply to a specific model for more in-depth customization you override:
app/templates/admin/index/:model.hbs
- lists all records for the
given modelapp/templates/admin/edit/:model.hbs
- edit form for the given modelapp/templates/admin/new/:model.hbs
- form for creating a new recordJust replace :model
with the name of your model. EmberAdmin will
always attempt to resolve a model-specific template before rendering the
more generic one.
If you want to access your models under a different namespace
override app/services/admin.js
in the following way:
import Ember from 'ember';
import EmberAdminServiceAdmin from 'ember-admin/services/admin';
export default EmberAdminServiceAdmin.extend({
namespace: 'custom'
});
So if your Dog
model's URL is typically:
/api/dogs
EmberAdmin will now try /api/custom/dogs
.
All models available to Ember Data will be included by default. But you
may not want to give access to all models. You can control this behavior
with the Admin Service object. You will need to override
app/services/admin.js
import Ember from 'ember';
import EmberAdminServiceAdmin from 'ember-admin/services/admin';
export default EmberAdminServiceAdmin.extend({
includedModels: null,
excludedModels: null
});
If you set includedModels
to an array like ['person', 'project']
then only the Person
and Project
models will be available to the
admin interface.
If you set excludedModels
to an array like ['person']
then every
model except Person
will be available to the admin interface.
You can mix includedModels
and excludedModels
:
includedModels: ['person', 'project'],
excludedModels: ['person']
This configuration means that only the Project
model will be
available.
All columns defined are included by default. But you may not want to
allow all columns to be listed on the index, or part of the form. Or,
you may want to use non DS.attr
properties. To define the specific
columns to include or exclude for a given model you need to override the
Admin Service object from the previous section, and modify the
following:
includedColumns: {
'person': ['name', 'age']
},
excludedColumns: {
'project': ['dateCreated']
}
includedColumns
and excludedColumns
are objects who's keys should
map to the model name. Each key's values are a collection of values that
should match properties.
The record index table will always have the id
property available.
And the record edit/create forms will never have the id
property
editable.
Plugins can take many forms but the general idea is that they will extend the default behavior of ember-admin
. Below is a list to choose from.
We are very thankful for the many contributors
This library follows Semantic Versioning
Please do! We are always looking to improve this gem. Please see our Contribution Guidelines on how to properly submit issues and pull requests.
DockYard, Inc © 2014
FAQs
Admin backend for ember-cli projects
The npm package ember-admin receives a total of 0 weekly downloads. As such, ember-admin popularity was classified as not popular.
We found that ember-admin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.