Integration of Open ERP & Django to configure openerp instances - django

I am new to Django.
I'm developing a Django application where user will enter UserName & DatabaseName (new Database to be generated by openerp)
So once User submits the username & dbname, it will call Open ERP API to create new database and setup new username/password as per specified in Django App.
Once new DB is configured, openerp API should also notify the user by email with the link (web client) to access his new account of openerp...
How can I achieve this ?

I dont think you can create databases via the XLM-RPC (I may be wrong), but you could just use Django to create a new postgres database with the openerp user as owner, and insert a default user into the user table. You could send an email from Django when its all set up.
Also have a look at these scripts which help administer openerp instances https://code.launchpad.net/~clearcorp/openerp-ccorp-scripts

Related

Intergrating Firebase Phone authentication and Django Backend

I have created a Django backend for my flutter app. I have used the Django rest framework to connect two. Now for user authentication, I am using firebase on my flutter application. It's working fine.
Now since the user management is done by firebase, how can I add a user to my Django backend when the user signup through my app to firebase. I want firebase to handle the signup/sign-in process but also want to create a user profile on my Django server which contains information about the user's address, profile pic, orders, payment history etc.
Also, I want Django to know if the user is authenticated with firebase while calling API requests. How can I make Django handle such requests?

CREATE SUPER USER in PaaS offering of Azure Database for Postgres?

i logged into the azure Postgres database , with the admin user credentials , that i gave at the time of creating the Azure Database for Postgres
Now when i try to create SUPERUSER , by giving the command
CREATE USER TESTER SUPERUSER; ---> it gives me error saying
must be superuser to create superusers
I was thinking , the ADMIN USER that i created for Azure Database for Postgres is itself the SUPER USER. Can we not create SUPER USERS in Azure Database for PostgreSQL
Please guide.
I figured out the answer myself.
In Azure Postgres , we cannot CREATE SUPERUSERS .
Since this service is a managed PaaS service, only Microsoft is part of the super user role.
Details in link here

WSO2 IS 5.2.0 change super administrator account

We are using WSO2 IS 5.2.0
We have integrated it with AD/LDAP (using LDAPUserStoreManager). We had userA from AD as our super administrator. Using this user we have registered all our apps under “Service Providers”.
Now because of some organisation changes we have to connect to different LDAP server for user authentication. We have changed the LDAP configuration manually in the user-mgt.xml file to point to new AD/LDAP server and userB from new LDAP is our new super admin.
Problem: We are not able to see the list of APPs that we had registered under “Service Providers” when we login as “userB”.
Question how can we transfer the list of apps (ownership) to new administrator?
We tried to update SP_APP table from backend but it is still not solving the problem.
(e.g. update SP_APP set username='userB' where APP_NAME='TestApp';)
Can someone please help us to know how can we transfer the list of apps under service provider so that it will be visible to new administrator?
When you create a Service Provider (SP), a role is created with it. If the name of the SP is "SomeName", a role is created is "Application/SomeName". Users with this particular role can see (and do any operation) that particular application.
So you need to assign these roles to the new admin user (or any other user that need to see the application) to make the applications visible to the new admin user.
See more information about creating service providers in WSO2 Identity Server in https://docs.wso2.com/display/IS541/Adding+and+Configuring+a+Service+Provider#AddingandConfiguringaServiceProvider-Addingaserviceprovider

Add new user into Wso2 CEP into H2 database

I need to add new user in Wso2 CEP (3.1.0) and I know that is possible by "clicking" few steps in console (example from documentation). I wonder if it possible to add new user without login into console, but connect to H2 database and insert user there?
I know that new user is save into "UM_USER" table.
Maybe someone knows what class write user into H2, how passowrd is enrcypted and what is "UM_SALT_VALUE" and why I need it?
If all you want is to manage users programmatically, a better way rather than trying to modify H2 DB is to do it through the relevant admin service. This way you don't have to bother about the underlying user-store or the salt values used for hashing passwords etc.
In Carbon-based products, most of the configurations done through the web console can be done programmatically by calling the relevant admin web service, such as user management, adding/managing deployment artifacts etc.
So for you use case, you can use the User Management admin service at:
https://localhost:9443/services/UserAdmin?wsdl
Note that in order to access this wsdl, you should make these admin service wsdl's visible by editing <CEP>/repository/conf/carbon.xml and restart the server.
<HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>

Authenticate against Drupal users database table from Django application

I'm working with:
A) A large Drupal 7.23 application running at https://sitename.com using a MySQL database with thousands of users, around 30 of which are Staff.
B) A small Django 1.3.7 application running at http://dj.sitename.com using a PostgreSQL database with few (only the Drupal app's staff) users, who need to be able to login to this Django app using their existing Drupal credentials.
The workflow would be something like this:
Staff users are manually created with identical usernames in each of the applications.
A staff user goes to dj.sitename.com and inputs the same username and password of their account that was created at sitename.com, and clicks submit. Django checks the username and password against the users table in the Drupal MySQL database and compares it with the details in the Django users table. If they match, the user is logged in.
When a staff user is already logged into the Drupal app and visits the Django app at dj.sitename.com, they are automatically logged in, and vice-versa.
When a staff user logs out from the Django app, they are logged out from Drupal, too, and vice-versa.
When a user changes their password in either Drupal or Django applications, it is automatically changed in both systems.
What is the simplest way to accomplish this?
You can use the Services module to expose Drupal user login as a HTTP service, which can then be used by your custom Django authentication backend. On successful login, the service will return you the Drupal user object. This object include the roles of the user, so you can use it to validate of the user has access to your application.
I had a similar request and I've detailed my solution in this howto. Both Drupal and Django run on the same server so I can use both TCP to share data between the two platforms and drush to do Drupal operations in Django.
Every login/logout has two steps:
Login: Django login -> (auto) Drupal login
Logout: Drupal logout -> (auto) Django logout
The turn point in the analysis of mine was to generate and use the one-time login after the Django login using Drush. Then, I use that generated url as a destination url of a login success in Django and alter or suppressing the password recovery message to avoid one more click.
from subprocess import check_output
output = check_output(["drush", "-r", settings.DRUPAL_SITE_PATH, "-l", settings.DRUPAL_SITE_NAME, "user-login", drupal_id])
Where drupal_id is the drupal uid of the just logged in django user. I have to keep a field for drupal uid in the django database. Via Drush you can even create an user when it's the first time you login successfully.
To logout you have to logout from Drupal and then logout from Django. You can do it via Rules, calling a django logout path after the event User has logged out is triggered.
What you're describing is single sign-on. You can look into phpSimpleSAML and enable SAML on both Drupal and your Django based app. Drupal has a module available here: https://drupal.org/project/simplesamlphp_auth
I'm guessing some type of SAML module/plugin exists for Django already.