I am using strapi for my project, and I'd like to customize the default schema and add some constraints.
Is there some strapi way to implement a custom table with multi-field key or some advanced constraints?
you can customize the model by modifing the modelname.settings.json file.
https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#models.
You can also implement policies to set up constraints.
https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#policies
Quoting response to my question at strapi community forum:
Not through Strapi itself yet we are looking into this for the v4
(once we have a public RFC ready we will let everyone know to give
time to review it).
But you can apply them at the database level manually for most cases
and they shouldn’t be broken by Strapi, certain constraints can’t be
applied at the database level (specifically unique as an example with
the I18N beta) but keys for example shouldn’t cause any issues.
Thus, what I ended up doing is hooking to bootstrap function and applying schema modifications there.
Related
I have a multi-tenant wagtail set up and we are currently working on getting up to date. We've just recently upgraded to v2.15 which introduced audit logging for all models instead of just page models.
AFAICT from looking through the wagtail code, the changes for a page model are only visible to superusers or admins with can_add_subpage or can_edit permissions which seems to effectively support multi-tenancy.
However, for all the other models there is no limitation put into effect. This means that an admin for Site A is seeing when changes are made to Site B or anytime a user is added or edited. We are using email addresses as usernames so this presents a rather major privacy issue.
This method hasn't been updated in any newer version, AFAICT, so I don't believe that just upgrading will fix this.
Does anyone have any ideas on either any wagtail settings we can change to keep Site and user changes invisible to non superusers or how we might localize BaseLogEntryManager.viewable_by_user so we can override the default wagtail implementation to our needs?
We have previously done something somewhat similar with the search available to admins by creating our own src/app/templates/wagtailadmin/pages/search.html and creating our own local version of https://github.com/wagtail/wagtail/blob/stable/2.13.x/wagtail/admin/views/pages/search.py
I had thought about trying to do something similar here however that doesn't seem like a good thing to do given how different those circumstances are and I think it was only possible using the register_admin_search_area hook.
I run a fairly large multitenanted Wagtail site. I have made public gist of the code we use in Wagtail 2.16 to restrict reports.
One of the main things we had to patch is the filters on the reports page. We do not want users on one site to even know there are other users in the system. This is implemented in the site_specific_get_users_for_filter method.
Although our non-page models all have site_ids, it was not possible to filter ModelLogEntries in site, so we settled for hiding that report from everyone except superusers.
I'm very new to Microsoft CRM, so please fix me if i'm wrong.
I have a business app that has the old web interface.
I don't want to setup a new solution for a client and provide a new api.
A want to reuse what is already there and adjust what data I will get when I request some project query.
My problem is that I cannot find where the schema is defined.
Can someone point me where to look for it?
Right now the api is working and I can retrieve data without problems, but there are some missing fields that are present CRM and not accessible via api. And my goal is to provide those fields
Thanks
go to make.powerapps.com
on right hand side select your env (dev/Test/Prod)
after that select solution on left hand side
then scroll down complete list you will find default solution
once you visit default solution, It hold almost entire system schema and so on. For example tables, it's fields and so on.
there are many other ways, but this should be a good starting point.
Note: It is not recommended to make changes directly under default solution, In fact it is bad way of making changes.
During development, I made quite a few changes to my model. Since Strapi doesn't migrate your db this results in an API with lots of confusing and useless fields (that are not in the admin UI), like in this screenshot.
The migration/database problem is a well known issue. However, is it possible to clean the API without fixing the database (which I don't really care if the API is clean) ? Ideally the API should mirror the admin UI.
If you are referring to the created_by and updated_by we have an open issue to hide these by default, it's being looked into by our engineering team: https://github.com/strapi/strapi/issues/7177
Can you clarify what fields in your screenshot you are referring to?
The old way I've always done it was to trigger a script on load and set the fields to this or that (hiding, locking etc.). But since we got those new, cool, shiny business rules now, I thought I could give them a whack.
The problem is that I can't figure out how to specify a condition based on the current user's role... Where is it hiding?!
They are not hiding because they don't exist. Business rules have a limited set of capabilities and they can't check the role of the users.
If you just need to lock the field Field Level Security can be an alternative, but for CRM 2013 you can only use on custom fields.
However good old JS + Plugin enforcement is (in my opinion) the preferred way.
I'm creating a solution which will be released as a managed solution for Dynamics CRM Online.
However, the customer will need to put information in when installing the managed solution to allow interaction with outside services.
For example, when you install the LinkedIn solution, you need to add your log in information to allow the CRM to access your LinkedIn account.
How do I add these parameters to the a solution, and then allow the customer to update them if they change?
Cheers
Edit:
To add to my query and following the answer below.
To make sure the process is correct in my head.
Option 1.
I will create a custom entity for storing key/value, or username/password combination.
I would then create a customisation page for the solution using html web resource, which when submitted, javascript would create a single record to hold those values.
I then need to link every record that needs the values stored in the custom record - I'm not sure how this would be done without editing a workflow after the storage record has been created, to link each normal record to the storage one.
Option 2.
Create an xml web resource that stores the values. Create the html/javascript resources to update this using the configuration page.
I can then use a javascript function to obtain that data when the custom entity is created, perhaps to populate hidden fields for storage and use behind the scenes.
I can't find any tutorials on getting started with using xml in this way - can you point me in the right direction?
I typically create a "Configuration" entity that has Name/Value attributes. This is also useful when you have Dev/Test/Prod environments that require different configs (e.g. URLs, credentials, etc).
Another approach is to using Plug-in configurations or Web Resources to store that type of information. The Plug-in configuration is pretty straightforward if you can have the customer use the Plug-in Registration tool to modify the value.