Comments (8)
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.
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.
Parameters for load and count are just an objects, sure you can modify that object as you wish.
from angular-sailsjs-boilerplate-frontend.
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.
commonParameters.where.user = _your_user_id_;
It's just plain object that you can modify as you like.
from angular-sailsjs-boilerplate-frontend.
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.
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.
ok. I understand it.
Thank you anyway.
from angular-sailsjs-boilerplate-frontend.
Related Issues (14)
- integration with ionic HOT 2
- datepicker options HOT 2
- Where is the correct way to add a js vendor? HOT 4
- datepicker refresh error HOT 7
- https server in the frontend HOT 2
- DataModel.setScope behavior HOT 5
- error in gulp dist HOT 12
- gulp dist do not create well a page HOT 2
- Integration with gulp-ejs HOT 2
- Node 4 compatibility HOT 1
- LiveReload causing net::ERR_CONNECTION_REFUSED HOT 4
- /admin/loginHistory gets redirected HOT 2
- [enhancement] DataModel to be much faster
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-sailsjs-boilerplate-frontend.