select database by user who logged in, in odoo - database

I have multiple users and same number of databases. A unique database for each user.
I want to select database dynamically whenever user login with his details. I don't want him to select or input his database name in any form. The selection should be automatic and without user knowledge.
One way to do it is using db_filter .
see here https://odoo-development.readthedocs.io/en/latest/admin/dbfilter.html
We can use different subdomain for each user and then database can be selected by subdomain name.
Is there any other solution?

You could specify the database by URL's param
For example:
http://localhost:8069/web/login?db=your-database-name

Related

Login and user is not there IN SQL Server 2017 then why in T-SQL it shows up?

Suppose I have a login metamanager\test which shows when I execute T-SQL, but it is not there when when I expand Security -> Login in SSMS.
Same with a database user.
I try to replicate but failed
use master
select * from sys.syslogins is used for login
use DB
select * from sys.sysusers is used for database user
A LOGIN and a USER are completely different objects.
A LOGIN is a server object, and appear in sys.syslogins, as you see.
A USER is a database object, and for a LOGIN to have access to a database, it needs to have a USER mapped to the LOGIN in that database. A LOGIN with no mapped logins in any databases, and without any server level roles, will be unable to access any of the database on the instance, apart from those that the public roles has in tempdb and master.
It appears, here, you need to create the user in the database, and then give it the appropriate permissions. You can create the USER with the following:
USE {YourDatabase};
GO
CREATE USER 'metamanager\test' FOR LOGIN 'metamanager\test';
You'll need to give it the appropriate permissions afterwards.
Also, after you have created the user, ensure you have refreshed your object explorer. Object explorer doesn't automatically refresh after you create an object.
Not sure if you explaining it correctly, but syslogins and server_principals are about the same. Only the difference that server_principals include "Roles".
As far as I know it is impossible to have something in syslogins, which does not exist in server_principals.

Possibility of creating a new SSRS user using query

As we all know that SSRS user can be created using Reporting Manager which can be accesses by the url given in Reporting Service configuration manager utility.
But, my requirement is to create a new SSRS user using a Query. I just want to know whether it is possible to do so or not. If yes, how?
something similar to this should work.
USE ReportServer
GO
IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'loginname')
CREATE LOGIN [loginname] FROM WINDOWS
GO
CREATE USER [loginname] FOR LOGIN [loginname]
GO
You can not create users using the Report Manager URL. The permission management/Role assignment only can be done through it.
Adding Login/User to [ReportServer] database does not mean that user can access the reports.
The Group or user name should be a Windows domain user or group account in this format: <domain>\<account>.
https://msdn.microsoft.com/en-us/library/ms156034.aspx?f=255&MSPPError=-2147217396
There is a way to achieve your requirement of checking users' access in a query. First, in Report Manager, give all users the "Browser" role (for example, "NT AUTHORITY\Authenticated Users"). Then, pass the current user of the report to your database query.
The current user of the report can be retrieved with report expression User!UserID. In my environment, this is returned in the form <DOMAIN>\<WINDOWS USER NAME>. See MSDN Built-in Globals and Users References (Report Builder and SSRS) for more info.

How do I design a Login page for multiple databases in VB.NET

I am working on a company project, in which it contains a data processing system and this system was previously written separately for each bank and have their own project file, and each of the project has their own database that store the user credentials for them to login using their id and password.
Now we need to merge all the projects together so that it only login via a single login page, but i am wondering how am i going to do this because the data, especially the login credentials is stored in different databases. How should I pass data from a database to another database to perform validation?
Assuming these are SQL server logins, You will probably have to build a database with an availableDB table listing the available databases. Let the user choose a database, then try to open that database using the specified credentials, kicking him/her back to the choose-a-database point in the application.
If that doesn't answer your question, we'll need a little more information: architecture, desired interface, etc.
Hope this helps.
Why Dont You Use a drop down on login form with Every bank name listed in Drop Down. After selection of bank, use if and else statements to populate selected bank database.

Sails.js Dynamically Switching Database based on users

I am currently building a project that requires switching between different databases according to the user logged in.
Every registered user has it's own database however the tables (the structure) within the databases are the same.
e.g. user login by authenticating at the default database, if true then get the databaseName from the default database accordingly and then connect to that database from then on.
Is there any way to achieve this?
Thanks!

Using Security Extension for certain reports only

My team has a service deployed internally, and part of this service is a list of client accounts stored in a sql table. SSRS is hosted on another server and we have integration jobs which [will eventually] pull these client accounts (along with additional info) from our 3 production environments to this SSRS database.
Also on this SSRS database, I’m creating a new table that will be a mapping of domain accounts and client accounts. I need this table so I can filter my report based on which client accounts the logged on user is allowed to see.
Pretty simple so far.
The next requirement of this is that I need to restrict access to the report itself. I understand I could normally use a security group to do this, but that would result in two separate locations to manage permissions for one resource and this is what I want to avoid.
The solution I’m looking into is to create a security extension to validate the logged in user against the database, allowing them access to the folder/report if they exist in the table. Once in, I can then use that same table again to filter their results.
What I’m not sure of is 1) if this is the best solution and 2) can I use a security extension for just MY portion of the site. There are many other users and reports on this site that I don’t deal with and don’t want to conflict with those.
Could you fill the DB table automatically from AD? Then you can use the standard windows security, but still only do the administration in Active Directory.
link text
You could set up an internal report parameter, called something like UserID, and set its default value to be the non-queried expression =User!UserID . (This user ID can be selected from the list of globals in the Edit Expression dialog.)
You could then add a cartesian/cross join to your users table in your query, with a selection condition based on your internal report parameter - eg. ...and UserTable.ID = #UserID . This would ensure that no records were returned if an unauthorised user was running the report.
Note that the User!UserID field will only return the user for interactively-run reports - in scheduled reports, this will be the account for the scheduling service.
Can't you restrict access to the report by using a security group (either in it's own folder or report level permissions). Use windows authentication in your datasource connection and filter you report retrieving your username using the sql function ORIGINAL_LOGIN?

Resources