How to create new portal user using web/signup url in odoo - odoo

Hello I want to create new portal users using web/signup url using backend. I want to create like this because I want to add tests in my module. My module assigns company id of users that created by using /web/signup page. I have multiple website. If user signup from website 1, it will assign company of website 1 in created users.

You can create a new user record by using create method from res.user model. For example,
self.env['res.user'].create({...})
You will need to pass an object containing required fields into the method for it to work though.

Related

How do you store user information in firestore if they don't have an account?

I am trying to create an app using firebase auth and firestore where new users can be invited via email to work on a project. The problem is, I do not know the best way to store the temporary user project permissions before they have a uid. I want the user that got invited via email to get access to the project upon opening the link sent to them.
I had tried two different ways
Having a sub collection doc for every user in the project
/project/{projectId}/users/{userId}
When a new user is invited, the userId was set to their email, having a cloud function that triggered when a new user was created to send the invite email to the user. Once the user opened the link, it deleted their user document and a cloud function ran that created a new doc with the users id now that they had once since they were authenticated.
This worked, but left a 10 second period where the user can't interact with the project because the cloud function for making the new user doc is running. Also it just seemed like a bad way to do it.
Having a single document with all of the user information
/project/{projectId}/users/users
users:{
roles: {
users_id: 'admin',
new_user_email: 'admin',
}
}
This one I was not able to get to work as firestore does not let you create a key with a period in it, but if there was a way around this, it would work as well. I had also set up firestore security rules which made it so they could only edit fields where the key was there uid or their email if they were not an editor/admin.
Consider creating an anonymous account in Firebase Authentication first, which requires no input from the user. It will receive a UID that you can use to store data for that account. Then, you can convert that account to a normal account after the signup or login succeeds.
Since you didn't say which mobile platform you're using, I linked you to the web docs, but the procedure is generally the same for each one.

Laravel 5.5 CRUD identified by user type

I am new to laravel and following online tutorials.I have created a basic laravel 5.5 app along with auth scaffolding which is working fine. Subsequently, I have created a form in the dashboard which users can submit after logging in the app.
I have created an admin panel which wherein requests submitted by users will be approved. But how to identify which user has submitted a particular request?
Should i include a column in the requests table "submitted_by" and in the crud controller, save the value from auth()->user.
Yes that would be the right way I usually do something like Auth::user()->create(//Here I pass request data or variables)

Advice on implementing secure page with a list returned from REST API

I'm new to Piranha CMS and just trying to get my head around it. I'm using the MVC implementation and I need to do the following:
I need to extend the User with a property that stores an account number.
I need a page that is only accessible once the user logs in
On this page, I need to call a REST API on another server, using the account number a parameter, to retrieve a list of documents that the user has stored on this server.
When the user clicks the document, it will be downloaded as a PDF using the REST API once again
I just need general guidance on how to do this. How do I store the account number against the user (and manage this) and do I need to create a new Region that will show the list of documents from the remote server. Is there an example of creating a new Region anywhere and maybe returning a list from SQL that I can adapt?
Any help gratefully received.
Thanks in advance
Mike
The easiest way is to implement an extension with your custom fields that you attach to the user where you store this information.
When editing a page, go in under "settings" and select which groups should have access to your page. For this purpose I suggest creating a new group for site users that are not admins.
This should be easily implemented in either the controller or model for your page. When the user is logged in "User.Identity.Name" is the user id. Get the user, load the extensions & use the account number.
See number three.
Regards

Joomla custom authentication plugin against own database table

I've created a custom authentication plugin, which allows me to login to Joomla with my own user Table. So at this point, the authentication to the system is working and a user object will be created. All information until logout can be seen with $user = JFactory::getUser();.
My problem is, that after login, my menue won't be shown. It seems, that my template is not loaded. If I manually change the userid to one of the registered users in Joomla (only the id will be changed, no other values of the user object), the template will be loaded and the menue will be shown.
What do I have to do to get this to work? What is missing, or what do I wrong?
Because of the Joomla rights system, Joomla calls getAuthorisedViewLevels() and getGroupsByUser() in libraries/joomla/access/access.phpin and looks up the groups from user_usergroup_map.
Because it is an external user authentication, there is no user_usergroup mapping.
Therfore I built a work around. During the login procedure I added a function to my plugin which sets the user_id in the user_usergroup_map table for temporary using.
In case of logging out, the entry in the user_usergroup_map table will be removed.

How to set parent id when using nested attributes form?

I am building a Rails 3.2 webapp. In this app I am using the gem Act_as_tenant.
I also got accounts (tenants) that has many users (trough a join table).
I am creating both the account and the first user using nested attributes.
The user model got an attribute called account_id which I need to fill with the created account. Both the account and the user is created successfully BUT the id of the newly created account is not set in the users model (account_id). How can I make sure it is?