The new Java project studies online notes -day18 (seven)

3 Fine-grained authorization requirements analysis 3.1
What is the fine-grained authorization?
Fine-grained authorization, also known as authorization data range, ie the same user has different operating authority, but the range of data that can be operated is not the same. An example: User A and User B are teaching institutions, they have "My Courses" privileges, but two users to query the data is not the same.
What fine-grained authorization of the project have?
For example:
my curriculum, teaching institutions only allowed to query information in the course of this teaching institutions.
My elective, students are only allowed to check their enrollment.
How to achieve fine-grained authorization?
Fine-grained authorization involving different service logic, the service layer is usually implemented, depending on the user for verification, query different data or different data according to different operating parameters.
3.3 My courses fine-grained authorization
3.3.1 needs analysis
1, my course queries, fine-grained authorization process is as follows: 1) get the user currently logged Id 2) get the user belongs to educational institutions Id
3) this inquiry learning institutions course information

Ultimately allowing only the user information about courses of their own bodies.
2, modify the course management service "My Courses" feature, according to the company Id queries course, ideas are as follows:
1) Modify Dao, support queries courses according to the company Id. 2) modify the Service, the company Id incoming Dao.
3) Modify Controller, to get the current user's company Id, passed Service. 3, the data model as follows: 1) curriculum
added company_id field course_base xc_course database table to indicate this home course

The new Java project studies online notes -day18 (seven)
Xc_company_user table obtained by the user affiliated company Id.
How to check a user's course?
1, determine the user's Id
2, Id according to the user's query user ownership of the company.
3, according to the company Id query information in the course of the company's
one example:

[mw_shl_code = applescript, true] / determine the user the above mentioned id: 49 /
/ user Id find your company / the SELECT
company_id the FROM xc_user.xc_company_user the WHERE user_id = '49'
/ According to the company owned by the inquiry curriculum / SELECT * FROM xc_course.course_base
WHERE company_id = '1' [/ mw_shl_code]

Guess you like

Origin blog.51cto.com/13517854/2429853