How to restrict access to spcecific attribute of strapi collection? - strapi

I have created a collection type that represents "question".
the type has these attributes:
title: string
content: string
email: email
answered: boolean
I am going to make a call to this collection endpoint from two places in my front-end website:
from Questions page and in this case I want to collection endpoint not to send the "email" of the user who raised the question
from admin page, where authenticated users can see the email of the person who raised the question.
Is there any easy way to achieve this?

Related

Plaid Public Exchange Token Response

eg from their site
{
"access_token": "access-sandbox-de3ce8ef-33f8-452c-a685-8671031fc0f6",
"item_id": "M5eVJqLnv3tbzdngLDp9FL5OlDNxlNhlE55op",
"request_id": "Aim3b"
}
My question is what is "item_id" and why it keeps changing on repeated requests. I understand that "access_token" to change on repeated requests.
This is what Plaid documentation says
"item_id - string
The item_id value of the Item associated with the returned access_token"
How what should I treat this Item_Id as? InstitutionID?
Is the item_id actually changing across multiple consecutive API requests, or only if you link an account multiple times? It is normal and correct for you to get different item_ids if you link the same bank account multiple times. Two linked accounts are considered different items even if they are actually based on the same user credentials at the same institution.
An item_id is an identifier associated with an item. It is less sensitive than an access token, because it cannot be used to access any data. So it is used as a safer way of referring to an item across the Plaid API than passing the access token around. For example, webhooks that give information about a change to an item will include an item_id to let you know which item the webhook is about.

How to expose product data to Policy List on SPCRM

On SPCRM I'm trying to expose Product Name on the Policy List page, inside the column called: Insurance Type.
Using inspect and console tool I could not locate the missing data
I am logged in as this user:
https://spinsurance.admin.kademi.com.au/manageUsers/116783806/#summary-tab
Policy List page:
https://crm.spinsurance.co.nz/leads/?query=&leadType=active&from=0&size=100
The product data is only exposed once you click a policy (under Insurance Type section):
example: https://crm.spinsurance.co.nz/leads/148615383/
I would like to know where / how I can update the lead/policy query to also include product data (Insurance Type) within the Policy list page.
OK, so assuming you have a custom field on your journey to hold the insurance type, similar to this example which has a field called "claim_recordId"
Then the JSON response on the leads page will include that in the fields object, eg:
You can then customise the JS for the leads page to show that field in a column

How to get user names and pictures of people leaving comments on a Facebook page you manage?

The field "from" returns nothing in this query:
https://graph.facebook.com/v3.2/(page id)?fields=posts{comments{message,created_time,from}}&access_token=(page access token)
The other fields return what I expect.
I'm administrator of the page but I haven't submitted my app for review because according to this page I don't have too, or am I wrong?
From the page:
Does not require App Review.
Grants your app access to the default fields of the User object that
are a subset of a person's public profile:
id
first_name
last_name
middle_name
name
name_format
picture
short_name
Or is there anything else I could have done wrong?
Without authorization, you cannot get any user specific data anymore, no matter if you own the Page in question. You can only get data like the message or the link to facebook.com.

Can I populate multiple fields in my Podio app using Email to App?

I've been trying to populate a Podio app using Email to App.
However, the problem is that the app only takes 3 blocks of data from an email submission: the subject, the sender, and the body. This would be sufficient if I had two fields of data to populate. However, I have 10 fields of data to populate in the app.
How can I send an email with the 10 fields of data and populate an app entry?
This article from 2010 is the only thing Podio says about this feature and yet it is not working for me. I have tried sending an email with
name:my name
location: my location
car: my car
...
in the body, and the Podio app simply places the entirety of the email in each field.
You cannot populate multiple fields with Email to App feature in Podio. To handle. Use Podio API for advanced use cases.
Populating multiple fields to Podio still works as descibed in https://help.podio.com/hc/en-us/articles/201019648-Email-to-app.
Email to item configuration:
Example email text:
Resulted item created:
If you are just looking to populate the data.
You could put the 10 items into the email body and send them as formatted text into Podio.
If you have dynamic data, you could achieve this by e.g. iterating through an array.
Other than that you have to use the API.
The method in the post you link to is correct and works.
In the email the format:
fieldname: content
.. gets mapped with "content" being put into the item's field with the name "fieldname". Use the field mapping user interface if you want to choose which fieldname:-label from the email maps to which field in the Podio item.

Help dealing with data dependency between two registration forms

I have a tricky issue here with a registration of both a user and his/her pet. Both the user and the pet are treated as separate entities and both require separate registration forms. However, the user's pet has to be linked to the user via a foreign key in the database. The process is basically that when a new user joins the site, firstly they register their pet, then they register themselves. The reason for this order is to check their pet's eligibility for the site (there are some criteria to be met) first, instead of getting the user to sign up only to then find out their pet is ineligible. It is this ordering of the form submissions which is causing me a bit of a headache, as follows...
The site is being developed with an MVC framework, and the User registration process is managed via a method in a User_form controller, while the pet registration process is managed via a method in the Pet_form controller.
The pet registration form happens first, and the pet data can be saved without the owner_id at this stage, with the user id possibly being added (e.g by retrieving pet's id from session) following user registration. However, doing it this way could potentially result in redundant data, where pet records would be created in the database, but if the user doesn't actually register themselves too, then the pets will be ownerless records in the DB.
Other option is to serialize the new pet's data at the pet registration stage, don't save it to the DB until the user fills out their registration form. Once the user is created, i can pass serialised data AND the owner_id to a method in the Pet Model which can update the DB. However, I also need to set the newly created $pet to $this->pet which I then access for a sequence of other related forms. Should I just set the session variable in the model method? Then in the Pet controller constructor, do a check for pet stored in session, if yes, assign to $this->pet...
If this makes any sense to anybody and you have some advice, i'd be grateful to hear it!
Here's a slightly left-field solution (which may or may not work depending on your situtation:
Require the user to enter a valid email address upon pet registration, and then link the user with the pet upon user registration by matching email address (or hash of email address).
If you're left with dangling pet references, you could send an email to the pet owner saying "I'm about to delete your pet" after a month (if there's no associated user id), or something like that.

Resources