Giter VIP home page Giter VIP logo

Comments (8)

tarlepp avatar tarlepp commented on August 17, 2024

Personally I would move that logic to backend. This is just ACL for the data. Also ACL in frontend is not so secure.

And of course it will return all the data on search filter change, if you don't add desired paramaters to that query.

This is application logic issue, not seed.

from angular-sailsjs-boilerplate-frontend.

jjgonver avatar jjgonver commented on August 17, 2024

And how can I introduce an additional parameter in count and load vars? I've tried in different ways but I'm unable.
I need that when

 if (!user.admin && !user.gestorIncidencias) 

then add an additional filter by user (user: $scope.user.id)
I'm in a hurry.
Thanks

from angular-sailsjs-boilerplate-frontend.

tarlepp avatar tarlepp commented on August 17, 2024

Parameters for load and count are just an objects, sure you can modify that object as you wish.

from angular-sailsjs-boilerplate-frontend.

jjgonver avatar jjgonver commented on August 17, 2024

Imposible for me.
Now commonParameters is an Object like this:

Object {where: Object}
  where: Object
    or: Array[2]
      0: Object
        nombre: Object
        __proto__: Object
      1: Object
        createdAt: Object
        __proto__: Object
       length: 2
    __proto__: Array[0]
  __proto__: Object
__proto__: Object

And parameters is:

Object {populate: "users", limit: 10, skip: 0, sort: "createdAt ASC"}
  limit:10
  populate:"users"
  skip:0
  sort:"createdAt ASC"
  __proto__:Object          

I try to add {user: $scope.user.id} in diferent ways and it does not work with neither.
How do you build the object to add the filter by user?
A lot of thanks.

from angular-sailsjs-boilerplate-frontend.

tarlepp avatar tarlepp commented on August 17, 2024
commonParameters.where.user = _your_user_id_;

It's just plain object that you can modify as you like.

from angular-sailsjs-boilerplate-frontend.

jjgonver avatar jjgonver commented on August 17, 2024

Yes. I've made something similar in the ui-router:

var parameters = {
                        populate: 'users',
                        limit: config.itemsPerPage,
                        sort: 'createdAt DESC'
                      };
                      if (!user.admin && !user.gestorIncidencias) {
                        parameters.user = user.id;
                      }
...

But here, in _fechData():

          // Common parameters for count and data query
          var commonParameters = {
            where: SocketHelperService.getWhere($scope.filters)
          };

          if (!user.admin && !user.gestorIncidencias) {
            commonParameters.where.user = $scope.user.id;
          }

I receive the next error:

ReferenceError: user is not defined

from angular-sailsjs-boilerplate-frontend.

tarlepp avatar tarlepp commented on August 17, 2024

Then you have not that user variable. And once again this is not seed problem this is just your application logic error - try to remember that this is not a common support channel.

from angular-sailsjs-boilerplate-frontend.

jjgonver avatar jjgonver commented on August 17, 2024

ok. I understand it.
Thank you anyway.

from angular-sailsjs-boilerplate-frontend.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.