Comments (11)
To clarify, I'm saying:
class UserCollection extends Collection {
current() { /* ... */ }
}
horizon.users = new UserCollection(...)
from horizon.
@Tryneus @coffeemug is this issue useful for tracking purposes or is it superseded by the work done on the server for auth?
from horizon.
This is for tracking purposes and not superseded. The big question is what the user management API will look like (e.g. how do I list users?) and whether we'll have a specialized one or let developers access user tables through the standard fusion API.
from horizon.
Right now the implementation of authentication has an internal table that tracks users. I guess an outstanding question is whether we should:
- A) move the metadata table to be an app level table
- pro: only one table, can use existing horizon commands to manage users
- con: this would be the first table we create for a user. They may mess it up so horizon can't understand it
- B) allow both an internal table for users and an app table for users if the app creator wants one
- pro: internal table is always understandable by horizon. App table is exactly what the app developer expects, with no magic.
- con: we lose atomic operations on users, since data is split over two tables for one conceptual entity
- C) ensure users are managed entirely internally by horizon, perhaps adding special commands for modifying a user
- pro: App developers can't break the user table, we can store whatever internal data we want, and expose only operations that are safe/valid on users.
- con: maybe inflate the api a bit
I'm partial to C, we might make a user look like a pseudo-collection:
horizon.user(userId).update({foo: 'bar'})
The internal user document would look like:
{ "id": 1,
// auth/permissions related fields here
"appData": {
"foo": "bar"
}
}
from horizon.
ping @Tryneus
from horizon.
Ok, so we've settled on pseudo-tables, roughly as described in #151 . The client is also going to add a .currentUser().fetch()
.currentUser().watch()
method that looks at the user id in the jwt received in the handshake, and then queries the user table appropriately.
from horizon.
@deontologician since the users
collection is available by default and there are probably going to be additional operations that only apply to the users
collection, we could expose it statically:
horizon.users == horizon('users')
horizon.users.current() == horizon('users').get(CURRENT_USER_ID)
I can see this being useful for other terms/helper methods like horizon.users.active().watch()
for observing users who are currently "online".
from horizon.
I think it'd be nice to support the normal table interface on it as well, so we don't have to duplicate things. Are you thinking about both horizon.users
and horizon('users')
existing?
from horizon.
@deontologician I certainly think people would expect horizon('users')
to work too, but I was thinking horizon.users
would be an instance of UserCollection
, extended with additional methods like .current()
. We'd have to add a special case in the Collection
constructor in order for horizon('users')
to return the correct instance type.
from horizon.
Cool, that seems reasonable
from horizon.
Bug fixed
from horizon.
Related Issues (20)
- debug: Rejecting Client without 'rethinkdb-horizon-v0' protocol()
- Roadmap HOT 9
- Organizational Meeting (April 5th) HOT 8
- Disable websockets option HOT 4
- Typo in embedded server documentation
- Error: Operation not permitted. HOT 4
- Let's Encrypt untrusted cert HOT 1
- iOS Websocket fatally fails when sending a frame over ~40kb
- [bug] "find" is required HOT 1
- Support for programmatic search filters in findAll method
- Using "rethinkdb" as an alias for the hz serve CLI connect options would failed
- /usr/app doesn't contain an .hz directory HOT 2
- Project dead ? HOT 39
- Website id down from last few days
- What is the best solution to upload files to horizen ??
- Your website's certificate is fscked up
- Please server on for this site. HOT 4
- Github will soon not support the authentication method
- auth_redirect = "/?parameter=foe" in config.toml cause token to not be successfuly created HOT 1
- [website] horizon.io taken by blockchain gaming company HOT 5
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 horizon.