loopback user model name conflict - loopbackjs

We are reviewing Loopback as a framework for establishing a RESTful API for our already existing MySQL database.
When using the StrongLoop Arc GUI for automatically discovering models based on our database, a conflict with the "user" table was reported.
The problem is that Loopback creates a default model named user, and our database has a table named user.
How do you recommend that we resolve this conflict?

Related

How can I implement authentication in Django

I am new to Django.
I am going to build simple register and login fullstack application by using React and Django.
My problem is when I received register request with form data.
Is it ok to create custom table for users?
I am going to create another table related to user table.
So in that case, there must be id in the users.
That's why I am going to create custom table.
Please help me it is good practice.
You can abstract from AbstractBaseUser and then you can customise the user model and to specify it in your settings file.
Please see the django documentation here:
https://docs.djangoproject.com/en/4.1/topics/auth/customizing/#substituting-a-custom-user-model
In Django you can link between multiple table by different relationships depends on what you want like:
OneToOne
ForeignKey
ManyToMany
And by default when you create a model django create a pk field it is ID for table, you can make another field as a primary key for model
When you use one of those relationships django by default use model id to link between them
and you can also create a custom user model to use it
Good luck

Django Database Design Problem - Multiple App Single Database

I have two django applications using the same database. These applications have their own models. Since both applications use the same database, I can authorize with common users, I can use User model as foreign key for models.
Let's call these two django apps A and B. Because A and B use the same database, a user can be associated with models in both applications.
If a user is associated with a model in both applications, the user I deleted from application A cannot be deleted because it is associated with a model in application B.
I think I made a wrong design. How can I overcome this problem?

StrongLoop Arc Composer Doesn't Discover Models From Different Schema Than DBO

I have a relational database on MSSQL, I've created this one on a different schema (titan) than DBO. When I try to retrieve the models from my database, the composer of strongloop arc only shows those tables that are currently saved on DBO schema but not my tables saved in my custom schema.
Any help might be useful. Thanks in advance.
For relational database discovery, LoopBack API allows you to supply schema and table. But the schema is not exposed by StrongLoop Arc. As a result, only default schema names are used by Arc. Please note dbo is the default schema name for mssql.
I suggest you open a feature request on github for StrongLoop Arc.

Django model wih a ForeignKey pointing to a salesforce model

I am using django-salesforce and I would like to create a model within Django that has a ForeignKey field pointing to a SFDC model (hosted on force.com).
I created a custom model on force.com, let us call it SFModel, and I can successfully work on it from django (CRUD) by subclassing salesforce.models.Model.
I also created a django.db.models.Model, let us call it DJModel, that has a unique field ForeignKey(SFModel). This model is registered on the admin panel.
All models validate and I can go to my admin panel to try to create a new instance of DJModel. However, when I try to display the create_form in the admin I get the following error :
hasattr(): attribute name must be string
and the debug stream says
So I tried to set an arbitrary alias to the SF entry in the DATABASES of my settings.py. There is a dedicated variable for that :
SALESFORCE_DB_ALIAS = 'youralias'
But I still have the same problem.
Any recommendation?
Django doesn't support it and an external reference to Salesforce should be currently saved as a CharField and a reference to other databases as IntegerField.
Django docs about Limitations of multiple databases:
Django doesn’t currently provide any support for foreign key or many-to-many relationships spanning multiple databases. If you have used a router to partition models to different databases, any foreign key and many-to-many relationships defined by those models must be internal to a single database.
I tried the cross reference with sqlite as 'default' database. It was possible to create an object of model DJModel with cross-database reference from sqlite to Salesforce. It behaves similarly to normal Django cross-database references, without obscure errors and only a dot reference can be used.
EDIT: Simplified after many years.

Django LDAP: How to map extra fields in Active Directory to Django User Database

I would like to map some of the field available in my companies Active Directory to my Django Application like department, Job Title so on. I am using the Django_auth_ldap for backend authentication and it copies the data and updates the record in the Django application Database. Since, Django Auth User table does not support these attributes what will be your suggestions of doing it? Please let me know if you need any more information.
Read here, map AD profile attributes to the django profile.
http://packages.python.org/django-auth-ldap/#user-objects
Here is documentation from django https://docs.djangoproject.com/en/dev/topics/auth/customizing/. Have you tried googling? There is already lot of info available for this.