Encrypted ID to 3rd party application - database

I would like to ask you a question that arose these days with GDPR new rules. What I have is a payments service which use BrainTree to make the payments. In our side we store some information including the ID of the user. The problem is that we should not send the original User ID to Braintree directly and we need an ID alias instead. What do you think that is the best way to do it? To encrypt is somehow or generate a second ID in my database?

Please add one new column with Unique reference(Alpha Numeric), which will be the unique reference for payment process. and when your internal Query logic operation and manipulation will be performed by user_id.

Related

REST-api structure when creating associated records during update

In my database, I have two tables, User and Location. Each user should have a location. If I have a user and want to update it, I use PUT on "users/:id", and could add locationId if I want to. What if location does not already exist? I am aware that I could first create a location and then update with the new locationId, but I would like to be able to do it in one request.
I have implemented a way to do this, where I can send a location-object under key: "location" in the body when doing the request in "users/:id". This works, but I understand that this means I am creating in my database, when the requests in itself is a PUT-request. I this allowed in REST, or do I need to do two requests to follow the best practices of REST? The two requests seems pretty annoying for client if I have multiple associations to the user, and would be a lot of requests.

Proper way to setup Firestore-database for friendlist-system

Im very new to Android development. At the moment I am trying to develop my first app. My app is going to have a friend-system. Im trying to setup the Firestore-database to match my conditions.
I want to use the UserID provided by the google authentication to control the access of the database.
Every user has a friendlist of usernames,since I think, its not safe to let any client know the UserID of another client.
My Firestore database looks like this:
"users" (collection)
UserID (document)
DisplayName, Username (fields)
"friendlist"
UserID
Username1,Username2,Username3...
Everytime I want to access data of a user inside my friendlist a have to retrieve data from the users-collection using the UserID-document. Since the client isnt allowed to know the UserID of the friend, I need another collection which I am planing to access through cloud functions to know which userID belongs to the username.
"usernames" (collection)
Username (document)
UserID (fields)
Is there a better way to minimize database-reads while protecting database accesses?
You could try looking for the UserID(document) based on the Username filed taking the answer from this other thread as a starting point.
Nevertheless, you would need to make sure that the Usernames do not repeat as this may cause issues later on by programming a check in the insertion of updates of usernames.
Otherwise, the solution you are planning would work although with the caveat that you may get a higher billing in the future as you are billed for every read as mentioned here.
Hope you find this useful!

Is it possible to update/delete User by externalId

We are trying to develop a SCIM enabled Provisioning system for provisioning data from an Enterprise Cloud Subscriber(ECS) to Salesforce(Cloud Service Provider-CSP). We are following SCIM 1.1 standard.
What are we able to do:
We are able to perform CRUD operations on User object using Salesforce auto-generated userId field
Exact Problem:
We are not able to update/delete User object using externalId provided by ECS.
Tried something as below... But it is not working, Unknown_Exception is thrown...
XXX/my.salesforce.com/services/scim/v1/Users/701984?fields=externalId
Please note that it is not possible to store Salesforce userId in ECS's database due to some compliance reasons. So we have to completely depend upon externalId only.
Possible Workaround:
Step1: Read the userId based on externalId from Salesforce
Step2: Update the User object using the salesforce UserId obtained in Step1.
But this two step process would definitely degrade the performance.
Is there any way to update/delete the User by externalId
Could you please guide us on this..
Thanks so much....
I realize this is old thread but wanted to note that you CAN update Users from REST using an external ID. The endpoint in above question is incorrect. Following is how it should be set, send as a PATCH request:
[instance]/services/data/v37.0/sobjects/user/[external_id__c]/[external id value]
Instance = your instance i.e. https://test.salesforce.com/
external_id__c = API name of your custom external Id field on User
external id value = whatever the value of the user's external Id
NOTES:
Salesforce responds with an HTTP 204 status code with No Content in the body, this isn't usual for patch requests, but it is 'success' response
The external id on user has to be a custom field, make sure it is set
as UNIQUE
Ensure the profile/permission set of the user that is making the call
has the Manage Users permission & has access to the external id field
It is pretty common pattern for other applications, too, to search first and then perform on update on the returned object. Your workaround seems fine to me. What performance problem are you concerned about? Are you concerned about Salesforce not being able to process more requests or are you concerned about the higher response time in your application because you need to make multiple requests? Have you actually measured how much an extra call costs?

URL to open Access Web DB form at specific record

I would like to create an email workflow using an Access Web DB form to manage holiday requests. The user will create a request from the form, save it - which triggers the SendMail data macro, ideally with a link in it for the approver to click and go to the approval form filtered to the correct request ID.
Does anybody know:
a) If it is possible to load the form in the browser filtered at the specific record ID. I have tried appending ?ID=1 to the form URL and so on, without any joy so far.
https://mysharepointserver.com/sites/mywebapp/default.aspx?ID=1
b) If possible, what steps do I need to go through to get it working?
This is an Access 2010 web database hosted on a heavily bespoke Sharepoint platform. Any help appreciated.
I have worked it out, using:
?Page={ID}
However, the one caveat with this is that if you delete a record then the page number refers to the records position in the table, not specifically the ID. If you can ensure that records are never deleted from the table it will remain aligned with Page number and ID number.
Its a bit of a pain, but if anyone finds a way of referencing ID directly that would be the ideal solution.
You can also use something along the lines of:
http://...sp_site_path.../default.aspx#Type=Form&Path=NavForm.Subform&Name=ActualForm&DataMode=Edit&Where=%3DID%3D1000
I believe the key part here is...
&Where=%3DID%3D1000
...which in this case refers to the database field [ID] and record 1000, ie:
[ID]=1000
The rest of the URL is refers to a specfic form within your site, however is you only have one, it is potentially not important for your purpose, and you would be able to get by with something like:
http://...sp_site_path.../default.aspx#Where=%3DID%3D1000
Since all my sites use navigation pages, I haven't tested this out

Do I need to insert one fake row in database?

I have few tables like example.
Users Books UsersBookPurchase
UID BookId UserId
UName Name BookId
Password Price
Email
This is fine. I am having my own login system but i am also using some 3rd party to validate like OpenID or facebook Authetication. My question is if the user is able to log in successfully using OpenID or facebook Authentication, what steps do i need to do i.e do i have to insert one fake row in Users table because if i do not insert how will integrity be maintained. I mean what user id should i insert in UsersBookPurchase when the person who has logged in using Facebook Authentication has made a purchase because the UserId is reference key from Users table. Please give me a high level overview of what i need to do because this is fairly common scenario.
Thanks in advance :)
Basically yes. Don't think of it as a fake row. What you should do is to create an actual user account based on the data provided by Facebook API (I am not that familiar with OpenID)
Facebook API will provide you with first and last name, email address, maybe some other data
Facebook does not have the concept of login name, users login by email address.
What you do is just create a new user from the data provided by API.
There are some things to watchout for: it is possible that user is already registered on your site. When you get data from Facebook you should search your own user table to see if the email address already belongs to your own registered user and it that case you can do some fancy things like mark that user as also having a facebook login.
If I were to do that, I'd abstracted login info into a separate table and have some sort of type in the User table. The type is used to identify what auth method is used, i.e. your own, Google, etc. If a user does select using alternative methods, you do need to have association but with a different type. But yes it is a new record.

Resources