so you'd do something like:
var isAllowedTo = require('../api/policies/isAllowedTo');
module.exports = {
UserController: {
create: isAllowedTo('createUser')
}
}
so you'd do something like:
var isAllowedTo = require('../api/policies/isAllowedTo');
module.exports = {
UserController: {
create: isAllowedTo('createUser')
}
}
I am keeping this as a reference to balderdashy/sails#352
Working with SailsJS v0.10-rc5: I am trying to keep the magic of blueprint controllers while at the same time protecting some model attributes from being changed by users on the default routes.
I.e.: prevent access to the is_admin
attribute on regular CRUD routes and implement a promote
action or something similar on the UserController which makes the neccessary checks.
In order to do this, I came up with the following policy in combination with a small addition to the model definitions:
// file: api/policies/protectedAttributes.js
/**
'use strict'; | |
var actionUtil = require('sails/lib/hooks/blueprints/actionUtil'); | |
/** | |
* todo | |
* | |
* @param {Request} request Request object | |
* @param {Response} response Response object | |
* @param {Function} next Callback function |
'use strict'; | |
var _ = require('lodash'); | |
var actionUtil = require('sails/lib/hooks/blueprints/actionUtil'); | |
/** | |
* Service function which adds necessary object specified conditions to Project | |
* model queries. Workflow with this is following: | |
* | |
* 1) Fetch project ids where current user is attached to |
terminal-notifier
installieren,/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier
,-sender tvbrowser.TVBrowser -title "{title}" -message "{channel_name} / {leadingZero(start_hour, "1")}:{leadingZero(start_minute, "1")}Uhr" -subtitle "{episode}"
$colors: ( | |
1: $blog-navigation-color1, | |
2: $blog-navigation-color2, | |
3: $blog-navigation-color3, | |
4: $blog-navigation-color4, | |
5: $blog-navigation-color5 | |
); | |
@each $color in $colors { | |
$nr: nth($color, 1); | |
$color: nth($color, 2); |
// frontpage widget colors | |
$frontpage-widget-color1: #00B5CC; | |
$frontpage-widget-color2: $green; | |
$frontpage-widget-color3: #CC181E; // youtube-rot | |
$frontpage-widget-icon1: "\f086"; // comments | |
$frontpage-widget-icon2: "\f007"; // user | |
$frontpage-widget-icon3: "\f16a"; // youtube-play | |
$colors: ( |
#!/bin/bash | |
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787779 | |
exec /bin/ntfs-3g.orig ${*/-s/} |
{ | |
"parts": [ | |
{ | |
"name": "ddi-plugin", | |
"hooks": { | |
"expressCreateServer": "ep_ddi/plugin:expressServer" | |
} | |
} | |
] | |
} |