2

ログインと特定の役割 (「19 歳以上」) が必要なセクションがあります。ログアウトするたびに、

Error: permission_denied: Client doesn't have permission to access the desired data.

これの理由は私のセキュリティ設定です:

".read": "root.child('users').child(auth.uid).child('data').child('role').val() > 19",

私のログアウト機能:

// Sign out functionality
App.controller('SignOutCtrl', function($scope, $state, Auth) {

    $scope.logout = function() {

        // Go to landing page
        $state.go('home');

        // Log user out
        Auth.$unauth();

    };
});


App.factory('Auth', ['$firebaseAuth', function($firebaseAuth) {

    var firebase = new Firebase('https://mysite.firebaseio.com/');

    return $firebaseAuth(firebase);

}]);

$state 'home' には読み取り制限がありません。セキュリティ制限をトリガーする 'home'-$state にリダイレクトされる前にログアウトが実際に行われるようです。

セキュリティ設定をトリガーせずに制限付きサイトからログアウトする方法の非常に基本的な概念を理解するのに苦労していると思います。誰かがそれを正しく行う方法を説明してもらえますか?

4

1 に答える 1