CityWebConsultants / Iris

Modular content management and web application framework built with Node.js and MongoDB
http://irisjs.org
Other
9 stars 7 forks source link

Extend permissions globally to allow callback #149

Closed FilipNest closed 8 years ago

FilipNest commented 8 years ago

Following https://github.com/CityWebConsultants/Iris/pull/124 you could make permissions extendable with a hook of some sort. It'd have to be a sync function as permissions checks happen inline so not sure it could work but something like:


iris.auth.globals.registerPermission("can write issues", "meta");

iris.auth.globals.extendPermission("can write issues", function(authPass){

    if(authPass.true){

        return false;

    } else {

        return true;

    }

})

Thoughts?

adam-clarey commented 8 years ago

My implementation was able to perform async operations

FilipNest commented 8 years ago

Which is great but we call it inline quite a few times so this would have to be sync. I suppose we could change permissions checks generally to be a promise. Might be a bit of a pain to write but it would give us nice flexibility for this sort of thing that could be used globally.

FilipNest commented 8 years ago

Closing for now as this may be a future improvement but isn't needed.