                 ,
 
                     (next)=> # check for roles restriction and test identity.hasRole
-                        if roles = (@data.permissions?[key]?.roles || @data.permissions?.roles)
+                        if roles = (@permissions?[key]?.roles || @permissions?.roles)
                             
                             identity.hasRole roles, (err, ok)=>
                                 next ok


                    (next)=> # check for general remote restriction
                        
                        next (@data.permissions?[key] || @data.permissions) isnt false
                        
                ,

                    (next)=> # check for login restriction
                        
                        if (@data.permissions?[key]?.login || @data.permissions?.login)
                            
                            identity.login (err, login)=>
                                next !!login


                     (next)=> # check for user restriction and test identity.login
                        
                        if user = (@permissions?[key]?.user || @permissions?.user)
                            
                            identity.login (err, login)=>
                                next login is user
