Skip to content

Commit

Permalink
Actually make changes to src files
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelVidaurre committed Sep 4, 2014
1 parent 8e25fae commit 998bace
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/permission.mdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@
$rootScope.$on('$stateChangeStart',
function (event, toState, toParams, fromState, fromParams) {
// If there are permissions set then prevent default and attempt to authorize
var permissions;
if (toState.data && toState.data.permissions) {
var permissions = toState.data.permissions;
permissions = toState.data.permissions;
} else if (toState.permissions) {
/**
* This way of defining permissions will be depracated in v1. Should use
* `data` key instead
*/
console.log('Deprecation Warning: permissions should be set inside the `data` key ');
console.log('Setting permissions for a state outside `data` will be depracated in' +
' version 1');
permissions = toState.permissions;
}

if (permissions) {
event.preventDefault();

Permission.authorize(permissions).then(function () {
Expand Down

0 comments on commit 998bace

Please sign in to comment.