ca1989

ca1989

Make admin user "approve" database changes

I am working on an admin website where users can perform CRUD operations on resources.

When a user with an unprivileged role changes a resource R, that should not go online immediately, but only after an admin has approved the changes.
So what I did was to create a copy of R
Problem is R has many linked subresources S1 ... SN.

So when the unprivileged user changes R and I create a copy R1 I should copy all the subresources as well, which doesn’t feel right.

Any other approach?

I thought about maintaining the original R in the database and a separate table to keep track of the changes.

The database is Postgresql

Cheers!

Marked As Solved

mayel

mayel

One approach could be storing the user suggested changes as a single map rather than in the relational tables, and only properly inserting them there on admin approval, like this function does for e.g.: paper_trail/lib/paper_trail.ex at main · bonfire-networks/paper_trail · GitHub (and using that lib would also give you version history)

Last Post!

ca1989

ca1989

Nice! Thank you

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130579 1222
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New

We're in Beta

About us Mission Statement