FAQ
Hello

I have the following situation:

- users
- users belong to groups
- tasks assigned to these users groups

The users can belong to one or more user groups.

The tasks can be assigned to one or more user groups.

Each user can view (and edit) the tasks they have a group in common with.

I would prefer the filtering to happen on the server, rather than returning
the whole node to the client and filter there.

I sort of have something working but I am afraid it is not the right/best
way, especially when I will have to secure my application.

I have something like:

users:
    alex: {name: 'Alex'},
    bruce: {name: 'Bruce'},
    charles: {name:'Charles'}

jobs:
    job_1: {title: 'Doing the dishes', done: false},
    job_2: {title: 'Taking the recycling down', done: false},
    job_3: {title: 'Drinking a beer', done: false}

users_groups:
    alex:
         group_1: true,
         group_2: true
    bruce:
         group_2: true
    charles:
         group_1: true,
         group_3: true

groups_jobs:
     group_1:
         job_1: true,
         job_2: true
     group_2:
         job_2: true
     group_3:
         job_3: true


This way I can easily build for my logged in user the list of groups he
belongs to, and in turn build the list of tasks that belong to each of his
groups.

"alex" belongs to groups 1 and 2 and therefore has access to jobs 1 and 2.
"bruce" belongs to group 2 and has access to job 2.
"charles" belongs to groups 1 and 3 and has access to jobs 1, 2 and 3.

I am not sure at all:

1) which is the best way to query the list of tasks from my "jobs"

var ref = new Firebase("https://xxxx.firebaseio.com/jobs/");
$scope.jobs = $firebaseArray(ref);

<ul ng-repeat="job in jobs">
     <li>{{job.title}}</li>
</ul>

Should I "filter" my ng-repeat loop?

Or should I send to the $scope a list of filtered_jobs and ng-repeat="job
in filtered_jobs"?

2) this is before I have even thought about securing my application...

Thank you!

--
You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
To post to this group, send email to firebase-angular@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/6d1a2cc7-d9d8-49b6-a07f-9c75522aa792%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Jacob Wenger at Jul 6, 2015 at 7:03 am
    Hey Benjamin,

    You may be able to glean some good insights from the discussion on this
    other Google Groups thread
    <https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/firebase-talk/Zh7nlQOE7H4/RAPyifEos5cJ>.
    I think the use cases are very similar. If you still have questions, feel
    free to post back here.

    Jacob
    On Fri, Jul 3, 2015 at 12:17 PM, Benjamin Pequet wrote:



    Hello

    I have the following situation:

    - users
    - users belong to groups
    - tasks assigned to these users groups

    The users can belong to one or more user groups.

    The tasks can be assigned to one or more user groups.

    Each user can view (and edit) the tasks they have a group in common with.

    I would prefer the filtering to happen on the server, rather than
    returning the whole node to the client and filter there.

    I sort of have something working but I am afraid it is not the right/best
    way, especially when I will have to secure my application.

    I have something like:

    users:
    alex: {name: 'Alex'},
    bruce: {name: 'Bruce'},
    charles: {name:'Charles'}

    jobs:
    job_1: {title: 'Doing the dishes', done: false},
    job_2: {title: 'Taking the recycling down', done: false},
    job_3: {title: 'Drinking a beer', done: false}

    users_groups:
    alex:
    group_1: true,
    group_2: true
    bruce:
    group_2: true
    charles:
    group_1: true,
    group_3: true

    groups_jobs:
    group_1:
    job_1: true,
    job_2: true
    group_2:
    job_2: true
    group_3:
    job_3: true


    This way I can easily build for my logged in user the list of groups he
    belongs to, and in turn build the list of tasks that belong to each of his
    groups.

    "alex" belongs to groups 1 and 2 and therefore has access to jobs 1 and 2.
    "bruce" belongs to group 2 and has access to job 2.
    "charles" belongs to groups 1 and 3 and has access to jobs 1, 2 and 3.

    I am not sure at all:

    1) which is the best way to query the list of tasks from my "jobs"

    var ref = new Firebase("https://xxxx.firebaseio.com/jobs/");
    $scope.jobs = $firebaseArray(ref);

    <ul ng-repeat="job in jobs">
    <li>{{job.title}}</li>
    </ul>

    Should I "filter" my ng-repeat loop?

    Or should I send to the $scope a list of filtered_jobs and ng-repeat="job
    in filtered_jobs"?

    2) this is before I have even thought about securing my application...

    Thank you!

    --
    You received this message because you are subscribed to the Google Groups
    "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/firebase-angular/6d1a2cc7-d9d8-49b6-a07f-9c75522aa792%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/6d1a2cc7-d9d8-49b6-a07f-9c75522aa792%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/CAGcMwsBvvK9OLhbaJ%2Bdqh1vPUTAyusUd4Ziq5qz64hWDzKgufQ%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupfirebase-angular @
postedJul 3, '15 at 10:42p
activeJul 6, '15 at 7:03a
posts2
users2

2 users in discussion

Benjamin Pequet: 1 post Jacob Wenger: 1 post

People

Translate

site design / logo © 2021 Grokbase