background
Before we wrote the program directly to the database access, and did not set what permissions and so on, but in the process of managing the database, we sometimes need to control the access of a user to the database, such as can only see a few tables belonging to its management, or have a crud (Increase ( Create), read (Retrieve) (re-get data), updates (update) and delete) permissions, or smaller granularity, all in all, for system security and ease of operation.
Introduction to system requirements
Recently has been doing the university cloud platform this project, our team does is one of the subsystem is the performance management system, different from the previous development mode, this time we use the Sub-module development is to divide the granularity becomes smaller, so there is a benefit, is responsible for their respective development and debugging.
But this also brings a problem, that is, the database is common, we are using the EF mapping is generated from the database entity, if you are logged in with an account, then see will be the same number of tables, in fact, this is not necessary, so the database provides us with better convenience, That is, assigning different permissions to individual users.
Operation Steps? Database-level logins are completed as shown in:
? Specific steps
Enter the database-level security settings----New login name,
First step: In the General tab, fill in:
Server role does not have to be reset
Step Two: User Mappings tab
Security objects do not have to be set
Step Three: Status tab
At this point, we have set the permissions for this user.
? Assignment of user Rights
Select one of the tables, the permission settings, must be the database that was just set up, otherwise it is not visible.
At this point, the appropriate permission settings can be
Now that we have finished, we can enter with the login name and password we have set, and see just a few of the tables we have allocated. Try it yourself.
Summary
Here just do some of the simplest database user permissions settings, which are used in the development process, some other more complex settings, in the process will be gradually applied and understood.
SQL Server R2 assigning permissions to users