Implemented authorization logic in angularjs with ui router