Prevent write to SQL until admin approval - sql

Gotta question. On my website I have a registration form that, once submitted, writes the data to a database. The address that the user provides is used to display their information on a google maps (city, state, country... not SPECIFIC location). Everything shows up on google maps instantaneously, but I'm worried that something will show up on there that shouldn't.
Say someone submits something on the form... like first_name "Seymour" last_name "Butts". Obviously, I don't want a marker added that shows Seymour Butts' location.
Is there anyway to submit a form, have it sent to a designated admin for approval, and, once approved, THEN have it write to the sql database? I think that'd be the best way to do it... I'm open to suggestions!!!!

Add a field to whatever table you write to that designates whether the item has been approved or not. You can then query the table for blanks to see which items need to be approved, and query for approved items to only show non-Butts items.

You could add it to an intermediate table, say a "WaitingForApproval" table.
Then you could write an admin tool listing the contents of this table with each item having an "Approve" button next to it, which would trigger the insert into the real table.

Related

Create login for multiple users with customized content with TYPO3 11.5.21

First of all, I must confess that I'm very, very new in TYPO3, therefore, my questions might be a bit confusing or not properly understandable. So, please be patient with me.
As already stated in the title, I want to create a login page for multiple users and every user should see a customized content, for example some pdf files or slides.
I was able to create a login page and it's working but I have no clue what's happening afterwards. I'm searching for a solution since days but the TYPO3 documentation is super shitty, especially for beginners like me.
My idea was to work with a MySQL database (I don't even know if this is possible). After the login all data about the customer are read from the database and defined files (some pdf and slides) should be shown.
Is this possible like that? Or how is the usual way to do that?
I'm happy for every hint!
Thanks a lot in advance :-)
cheers,
expikx
I tried to find a solution online but without success
you need a custom extension which will render the files based on the logged in user. By using the extension "extension builder" you can create a first version of your extension very quickly which can be used as base.
If you are german speaking, take a look at the videos of Stefan, e.g. https://www.youtube.com/watch?v=dhRBvTZoPQM& which document how to create an extension as well
If you use the Login of TYPO3 you can also use the access-management from TYPO3 for FrontEnd content:
for each erecord (page, content, news, ...) you can decide which group(!) of users can see it.
Each record in TYPO3 normaly contains a field (in the access tab) to select which groups can see this record.
It's up to you to define the groups each user belongs to.
And each group can access some content. TYPO3 merges it and even can give access to one record to multiple groups.
Regarding files like PDFs: if you do not need absolute access restrictions it would be possible to only list links to the files for the apropriate groups. (other users, even not logged in users could access the files if they know the URL)
e.g.:
You have users in three groups like owner of product A, product B, product C.
Of course there are owners of multiple Products.
For each group you can provide content like manuals, updates or lists of service points.
First you can give access to the pages about each product only to member of the matching group. All the content of that pages are visible only after login and if the user belongs to that group.
But you also can have mixed pages:
Maybe news where all updates are shown. Although each news record has (at least) one group to be shown to.
There could be one page with the news plugin to show all news. After login only those records are shown which belong to the groups of the user, other records are hidden. (not logged in users can see only records not restricted to any group)
If you want a individuality of content by person you need a group for each user.
If you want the user to select by himself what his interests are you need a FE plugin where he can select his memberships of individual groups.

How to show all mails with no restriction of user?

I am in need of showing "All Mails" that have been transacted in OpenERP 7 with no restrictions.
There seems to be some restrictions done when records are fetched from Database(postgresql).
Is there a way to show all the records available in postgresql directly?
Their are several ways, you can use any of below:
You can create Separate menu without any domain on mail.message object which will show you all the messages.
Also you can create the postgres view report for more statistical information on mail.message object this will be tricky and long but informative in future.
Or Even you can remove the Domain from the existing Email menu action to show all the record without any restriction.
Thank You

Creating a form to send multiple emails to existing emails using Rails

I'm building an order management system for customers. I need to set it up so I can build a form that emails a brief of the order status to a customer. The trick is that a customer can have multiple emails i.e no limits on that and the form I need to set up would show the brief generated in a textbox(nothing hard there) as well as a list of checkboxes with the email addresses which to send to.
Clicking on/off the checkboxes determines which addresses would the brief be sent to. I have everything worked out except for one main thing i.e the form - I'm not sure how can I actually set this part up i.e I'm using simple_form here and I'm not sure which model would I be making the form against? Do I need to build another model here? I'm pretty stuck.
May be you can create model like Email without database and use all ActiveRecord helper methods. These articles may be helpful.
http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/
http://railscasts.com/episodes/193-tableless-model?view=asciicast

Linking actions on two tables

Sorry the title isn't very descriptive, but here is what I'm trying to do:
I am making a website that handles student group funding requests. A particular request for funding could involve any number of items. I have two tables: requests and items. A group begins a request by filling out a "request" form, which contains a brief summary of the request, a category (speaker, advertising, etc.), and some other fields necessary for the bureaucratic process. That works fine and was handled pretty much entirely by scaffolding. The problem I'm having is with the "items". I would like the user to click the "submit" button on the new request form and be taken to another page at which he can add any number of items to the items table, all containing in a field the id of the request he just submitted.
The front end appearance doesn't really matter - it could all be on one page - what's important is that the user submits information to one table and then submits information to a second table, with the info sent to the second table containing something that connects it to the information just submitted to the first table.
As you can probably guess, I'm pretty new at rails (I went through the book Head First Rails and I'm working on my first project), so I'm looking for a general explanation about how this can be accomplished.
I recommend you to read / watch this tutorial. It is quite good.
UPDATE:
http://railscasts.com/episodes/196-nested-model-form-part-1
Hope it helps.

Forms in Ruby on Rails

Ive recently started using Ruby on Rails for a project of mine and have hit some interesting walls. Im using scaffolding but instead of moving to the default show page after i have entered data, i want to instead redirect to another page i have created.
The key is the page is another form and half of that form is made up of values entered in the previous form. So ive guessed that i have to keep that in memory instead of allowing it to be written to the database. My original idea was to query the table and find the last record but with multiple users its probably not advisable.
Can anyone help? Examples would be great or even just to point me in the right direction
Im pretty familier with C++, jave etc, so i understand computer jargon.
thanks
Do you care if the data from the first form is stored in the database before going to the second form? If not you can just set the create action in the controller to redirect to the new page you want. Depending on how you are managing the user session, you could then pull up the information the user stored in the first form. For example if you were using Devise to handle the session, you could have the user enter their username, email and password in the first form, then redirect to a profile form that has a separate email option. You could pre-populate the field to show the user.email, but give the user the option to create a separate email for their profile. In your new action for your profile you would just add #profile.email = current_user.email. Keep in mind, this will allow the user to edit this field separate for both tables.
If you want the data entered in the two forms to point to the same database table, I would recommend looking at using nested attributes. This way, you do not have an email columns in separate tables. Railscasts has a pretty good episode on how to do this. http://railscasts.com/episodes/196-nested-model-form-part-1
You can store all entered in the first form data in session. After redirect you can fill all form inputs from stored data in session and then clear that session data.