so you'd do something like:
var isAllowedTo = require('../api/policies/isAllowedTo');
module.exports = {
UserController: {
create: isAllowedTo('createUser')
}
}
{ | |
"parts": [ | |
{ | |
"name": "ddi-plugin", | |
"hooks": { | |
"expressCreateServer": "ep_ddi/plugin:expressServer" | |
} | |
} | |
] | |
} |
#!/bin/bash | |
postreceivescript=$(git config hooks.postreceivescript) | |
redmineid=$(git config hooks.redmineid) | |
url=$(git config hooks.url) | |
while read msg; do | |
echo "Sending post-receive email" | |
echo "$msg" | /usr/share/doc/git-core/contrib/hooks/post-receive-email |
#!/bin/bash | |
# http://blog.streak.com/2013/01/how-to-build-safari-extension.html | |
XAR=path/to/xar/bin | |
BUILD_DIR=path/to/dir/with/cert/files | |
EXTENSION=your extension name | |
$XAR -czf $EXTENSION.safariextz --distribution $EXTENSION.safariextension | |
$XAR --sign -f $EXTENSION.safariextz --digestinfo-to-sign digest.dat --sig-size `cat $BUILD_DIR/size.txt` --cert-loc $BUILD_DIR/cert.der --cert-loc $BUILD_DIR/cert01 --cert-loc $BUILD_DIR/cert02 | |
openssl rsautl -sign -inkey $BUILD_DIR/key.pem -in digest.dat -out sig.dat | |
$XAR --inject-sig sig.dat -f $EXTENSION.safariextz |
#!/bin/sh | |
# This program has two feature. | |
# | |
# 1. Create a disk image on RAM. | |
# 2. Mount that disk image. | |
# | |
# Usage: | |
# $0 <dir> <size> | |
# |
/** | |
* simple JSONP support | |
* | |
* JSONP.get('https://api.github.com/gists/5973376', function (data) { console.log(data); }); | |
* JSONP.get('https://api.github.com/gists/5973376', {}, function (data) { console.log(data); }); | |
* | |
* gist: https://gist.github.com/edy/5973376 | |
*/ | |
var JSONP = (function (document) { | |
var requests = 0, |
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 |