-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identity model created #2556
Identity model created #2556
Conversation
98866dc
to
a240eb1
Compare
@publiclab/reviewers I have ran rake db:migrate on my local machine but travis shows that the migrations are pending. How shall I run migrations on travis? |
@@ -0,0 +1,3 @@ | |||
class Identity < ActiveRecord::Base | |||
belongs_to :user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably use a validation here to check for the presence of user_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh thanks @seafr
I did change it.
You can update the db/schema.rb.example file and it'll use the latest schema. Looking good! |
7acd470
to
a1cacbc
Compare
Hi @jywarren still the Travis is failing what I need to do?? |
hi @SidharthBansal , you just need to copy the checksum of migration into the top of schema.rb.example and test will pass. |
a1cacbc
to
2367abb
Compare
Generated by 🚫 Danger |
Thanks @Gauravano . |
Looks awesome! Should I merge now, or are you going to add some unit tests? Or will that be in a follow-up PR? |
I will add them in following prs |
Hi, I was thinking a bit here -- is there a reason to create a new database model for this, or do you think we could store this information in a Sorry this took me a few days of thinking to articulate this question. But I don't think going the other route would be too much trouble given how well you've modularized your planning. What do you think, and are there pros/cons to the |
Hi @jywarren there is a need to create a new table to hold the provider (Facebook,twitter ,google ,github etc) ,uid for the id given by the provider of the account and the user-id to associate the identity with the user model. We would login through identity. We require multiple providers aka identities for a single user. When try to login or logout we will use these models. Yes we require future information the uid given by the provider and the name of the provider. The app secret and the app id we need to write them in the config files. |
So in UserTag, we would follow the Power Tags convention of `key:value` as
strings, so my thought was to do `accountProvider:user-id` -- but if we
ever need a third parameter, or a secret parameter, then this won't work as
well. and for multi party login, we could have:
`twitter:jywarren`
`twitter:warren`
for example. Would that work? Or can you add in here some example cases
that would demonstrate how UserTag would not be possible?
Sorry if I'm being dense here, just trying to see if we can save
complexity! But if we cannot, this Identity model looks fantastic.
…On Fri, Apr 6, 2018 at 10:30 AM, Sidharth Bansal ***@***.***> wrote:
Hi @jywarren <https://github.com/jywarren> there is a need to create a
new table to hold the provider (Facebook,twitter ,google ,github etc) ,uid
for the id given by the provider of the account and the user-id to
associate the identity with the user model. We would login through
identity. We require multiple providers aka identities for a single user.
When try to login or logout we will use these models.
We can't do it in usertag model. If I am not wrong, usertag is the tags
which are displayed on the profile page rt? We require those tags for all
the providers. We require a separate model for login and logout.
Yes we require future information the uid given by the provider and the
name of the provider. The app secret and the app id we need to write them
in the config files.
The user tag model has uid , value ,updated at and created at fields in
the schema. We do require other parameters uid given by the provider and
name of provider as in multi party login two or more author service may
give us the same uid. Does this makes sense?
Also, there would be ability to delete the identity at time of unlinking
of the account and making new one at on linking new provider.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2556 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ4gQtUwYeSSJGp1bswC7gjJ9Mu28ks5tl4ovgaJpZM4S__Bl>
.
|
@jywarren we can adopt the value as "facebook:warren", "twitter:jwarren" etc. But we may need to retrieve and store other apart from these in future like these
Consider the case of image it may be possible that the user has uploaded Image1 on fb as profile pic and Image2 on the twitter then we do need to show the same user different profile pics on public lab login through providers. If the user logs in through fb he will get the Image1 otherwise Image2. |
Also, if we use the usertags we need not to shows the oauth related user tags on the profile page. |
ohhhhh wow! There's so much info there! Exciting, although also want to be
considerate of people /not/ wanting to share it all.
I think we could add fields like `time_zone:______` and `location:______`
and `facebook-picture:_______` if we want, but one thing I'm thinking of
that would /save/ us time is if the profile tag UI were what we used to
store all of these, making it unnecessary to develop a separate Identities
storage/management UI. I think most of these I can see are ones we could
adapt to a UserTag in one way or another.
The picture URL maybe wouldn't fit into a key:value format, now that I
think of it. But we can do that in a follow-up; we don't have to come up
with a way to use *every* piece of data here, at least not all at once.
What do you think? we could automatically import a few of these into
UserTags, then prompt people to remove the ones they don't want to share?
Pros/cons to that idea?
…On Fri, Apr 6, 2018 at 11:23 AM, Sidharth Bansal ***@***.***> wrote:
Also, if we use the usertags we need not to shows the oauth related user
tags on the profile page.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2556 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ7PZlg3eSTSGi6yo8Oa8HVcYfxRUks5tl5adgaJpZM4S__Bl>
.
|
Actually the user will grant the permissions for these fields. Some of the user grant some permission while the other grant other permissions. Also the various informations which we can get are different in case of different providers like we discussed the email case of twitter. |
One more thing to consider is the Usertag model has many power tags like "lat:"," lon:" etc. So, searching the "provider:uid" field among them all is having higher time complexity then searching in the identity model where we only need to search those fields which all have these "provider" and "uid". |
Aha -- so if we were to use DB optimization is a good point, but relative to the complexity of searching the NodeTag table, this is not so bad, and indexing helps a lot. What do you think of the above? We already prevent some types of powertags on nodes on these lines: Lines 835 to 845 in 9795328
|
Yeah this way, we can do. I was also thinking of this way. Yeah, indexing helps you are right. So, let's close this PR and first quickly write validation for provider:uid first. |
We are not using the can_tag method in the create action of the usertag controller but we are using it in the tagcontroller. So, we are able to create tags with the 'format:rss' etc which we should not be able to make. plots2/app/controllers/user_tags_controller.rb Lines 14 to 39 in ac3dce1
plots2/app/controllers/tag_controller.rb Lines 271 to 301 in ac3dce1
So I think first of all we should make the usertag's controller create action to work right. |
Aha - great catch. I think we should implement can_tag in UserTag as well! |
Great, deep work here, @SidharthBansal !!! |
Yeah working on this today. Was not able to do it because I was having exams. |
#2388
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
fixes #0000
-style reference to original issue #@publiclab/reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays.
Thanks!