How to audit common userid usages in Snowflake? - snowflake-cloud-data-platform

As per audit requirement, I need to track and monitor common userid source and usages.
We have some dba common userid's which are attached with different owner roles. As per audit requirement, I need to track and monitor who the individual is using common userid and activities?
I can see SNOWFLAKE.ACCOUNT_USAGES views are giving me some information.
QUERY_HISTORY ==> Query from user and Session ID
SESSIONS ==> Session ID and Login Event Id
LOGIN_HISTORY ==> Event ID and Client IP
But here I can get up to client IP address information only. I can't find which is client side userid. If I get this information then it some way to tag it to individual user.
Any idea, how can I get this information?
Thank you,
Shrini S

Related

Is it possible to save additonal data in Sessions Table in CakePHP 3?

I need to do the following tasks in CakePHP 3:
Logout users manually
Limit the number of sessions to one per user
I'm using database sessions to accomplish that. Is it possible to save additional data in sessions table? If yes, could you give me an example please?
The session database model is a cake model like all the other models, which means you can interact with it, in the same way, by adding new columns to that table and/or deleting sessions if needed. Use the model object to update delete entities in that table (I assume you're talking about cakephp 3.x)
Limiting the number of sessions to one per user can be tricky as sessions are created even if a user is not logged in. So you will have "user-less" sessions in your database as well.
Suggested way to tackle this
When a user logs in, get the current session ID and find the row in the session table that needs to be updated to include the username
At this time you may also want to delete the other rows that have the same user name, effectively destroying all the other sessions for this user.

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?

Can I include a custom payload or value with amazon affiliate links?

I'd like to be able to tag affiliate links with some extra information so that I can map successes to information inside of my system.
Is there any way I can include a custom identifier or payload of data with the affiliate link that Amazon will allow me to inspect when I receive a report of successful sales?
The only thing I found is the tracking ids from
Manage Your Tracking IDs page.
However this ids are limited to 100 values by default (you need to contact amazon for more). This is what they answered me:
I understand you'd like to view reporting within Products Advertising
API.
All reports are housed on your Associates account for you to view the
activity of your links.
We do offer multiple tracking IDs so that Associates can track the
activity of individual links easily and accurately.
You can create up to 100 tracking IDs in your account by visiting the
Account Settings section of Associates Central. You'll find a link in
the Account Information section labeled Manage your tracking IDs:
https://affiliate-program.amazon.com/gp/associates/network/your-account/manage-t...
Once you've created your additional tracking IDs, to view these IDs,
please log into Associates Central (http://associates.amazon.com).
Once logged in, click on the drop down box under Tracking ID to change
which ID you are working with.
If you are interested in receiving more than 100 tracking IDs, please
first create this amount via your associate account in Associate
Central. If you have already created 100 tracking IDs in your account
and are needing additional tracking IDs, please use the link below to
write back to us with a detailed description of how you'll be using
these additional ID:

suggetion for a database design

I have a scenario and looking for a good database design. My application provide 3 different roles. Admin, Customer, and Narrator.
Customer choose a Narrator and request a service. His request process by Admin to check whether it is valid or not. If it is not valid, Admin will send it back to the Customer with a message. Otherwise, Admin will send the request for the chosen Narrator. The Narrator perform the request and send it back to the Admin. Admin will check it again against some circumstances. If validation fail, Admin send the request back to the Narrator with a message. Otherwise, Admin will mark that request as finished and send it to the Customer.
Here is my basic tables:
User
username
password
email
Narrator
image
rank
user_id (FK)
Customer
phone_number
address
user_id (FK)
Request
customer_id (FK)
narrator_id (FK)
...
Actually my problem is how I should design my tables in order to support such a transaction.
I appreciate your suggestions.
Your text explaining what kind of service you want to deliver is a good lead about what type of models you need. You write about 'admins' and 'messages' but those models are omitted. I also think that 'request' is a property of a Service.
Maybe go for more general terms? Client, Supplier, Message, Service, Manager, Product. The Service needs a state field: new, assigned, needs more X...
Then your story goes as follows:
A Client chooses a Supplier and sends a Message to request a Service. A Service request is created with the status 'new'. The request will be reviewed by a Manager: He sets the state of the Service to approved and with that one click also send notification Messages to both Client and Supplier. The Supplier will preform the Service and on completion change the state... et cetera.
I wonder where Invoice comes in and maybe you need to deliver a Product in the end.

generate unique user id for tracking code script

I am trying to implement mixpanel to my website. Is generating a user_id via javascript and storing it on the database is the only or recommended way to generate unique user_id. (consult the database to ensure that id's generated are unique) ?
You absolutely don't want to store an ID for each one of your visitors in your database. If you think about tracking all your visitors, you can generate a unique identifier in Javascript (UUID) and store it in a cookie on the user's browser.
Generate UUID : https://stackoverflow.com/a/8809472/3667380
Work with cookies : http://www.w3schools.com/js/js_cookies.asp
or if you prefer using JQuery : http://plugins.jquery.com/cookie/
However, if you want to track your registered users, you should consider using the database to prevent registered users from cleaning their cookies. By using your database, you ensure that every logged in user will always get the same id.
You can abslolutely use the two options together : UUID and cookies for your unregistered visitors and Database ID (hashed maybe) to identify your registered users.

Resources