You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> ☝️☝️☝️ This hooks should be written only inside column. If you'll add it in resource hooks - it won't work
214
+
207
215
In our case we limit the dropdown list to show only the current user, however you can use same sample to list only objects who are related to the current user in case if you will have relation configurations which require to show related objects which belongs to the current user.
Out of the box, AdminForth connects directly to your database using one of the supported drivers (PostgreSQL, MySQL, ClickHouse, MongoDB) and executes queries against it.
4
+
5
+
In some cases, you may not want to expose a direct database connection to AdminForth. Instead, you may prefer to allow AdminForth to access and modify data through your own APIs (for example, REST, GraphQL, or JSON-RPC).
6
+
7
+
With this approach, AdminForth never connects to the database and never even knows its URL. All read and write operations go through your API layer.
8
+
9
+
Why do this?
10
+
11
+
- Your API may enforce additional constraints or validation rules.
12
+
13
+
- You can precisely log all operations using your own logging or audit systems. (The built-in AuditLog tracks data modifications only and does not log read operations.)
14
+
15
+
- Your API may contain custom logic, such as distributed workflows or complex data-modification rules.
16
+
17
+
To implement this, you need to extend the data connector class and implement a small set of methods responsible for data access and mutations.
18
+
19
+
This example demonstrates how to do this using GraphQL, but the same approach can be adapted to REST or any other protocol. The code comments include detailed guidance for these cases.
20
+
21
+
Another reason to create a custom data source adapter is to support a database that AdminForth does not yet support. In that case, you are welcome to submit a pull request to AdminForth to add native support for that database.
0 commit comments