File tree 5 files changed +20
-9
lines changed
packages/nginx/etc/nginx/templates/location.d
5 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 2
2
# Nitrobase file location that can be accessed by anyone.
3
3
4
4
location /$nitrobaseRegionPublic/ {
5
- if ($authUserToken = 0) {
6
- return 403; # User not defined
5
+ if ($authUserToken = "") {
6
+ # User not defined
7
+ return 403;
7
8
break;
8
9
}
9
10
Original file line number Diff line number Diff line change 2
2
# Nitrobase file location that can be accessed by authenticated users.
3
3
4
4
location /$nitrobaseRegionAuthenticated/ {
5
- if ($authUserToken = 0) {
6
- return 403; # User not defined
5
+ if ($authUserToken = "") {
6
+ # User not defined
7
+ return 403;
7
8
break;
8
9
}
9
10
10
11
if (!-f $document_root/$userLocation/.token/$authUserToken.asn) {
12
+ # Token file not found then user not authenticated
11
13
return 403;
12
14
break;
13
15
}
Original file line number Diff line number Diff line change 2
2
# Nitrobase file location that can be accessed by admin and managers only.
3
3
4
4
location /$nitrobaseRegionManagers/ {
5
- if ($authUserToken = 0) {
6
- return 403; # User not defined
5
+ if ($authUserToken = "") {
6
+ # User not defined
7
+ return 403;
7
8
break;
8
9
}
9
10
10
11
if (!-f $document_root/$userLocation/.token/$authUserToken.asn) {
12
+ # Token file not found then user not authenticated
11
13
return 403;
12
14
break;
13
15
}
14
16
15
17
if (!-f $document_root/$userLocation/.auth/manager.asn) {
18
+ # Manager authentication file not found then user not a manager
16
19
return 403;
17
20
break;
18
21
}
Original file line number Diff line number Diff line change 3
3
4
4
location ~ ^/(?<requestLocation>$nitrobaseRegionPerUser/[A-z0-9_=-]+/[A-z0-9_=-]+)/ {
5
5
6
- if ($authUserToken = 0) {
7
- return 403; # User not defined
6
+ if ($authUserToken = "") {
7
+ # User not defined
8
+ return 403;
8
9
break;
9
10
}
10
11
11
12
if (!-f $document_root/$userLocation/.token/$authUserToken.asn) {
13
+ # Token file not found then user not authenticated
12
14
return 403;
13
15
break;
14
16
}
15
17
16
18
try_files $uri =404;
17
19
18
20
if (-f $document_root/$userLocation/.auth/manager.asn) {
21
+ # Manager authentication file found then user is a manager and can access other user's files
19
22
break;
20
23
}
21
24
22
25
if ($userLocation = $requestLocation) {
26
+ # User requested his own files
23
27
break;
24
28
}
25
29
30
+ # User requested other user's files and is not a manager
26
31
return 403;
27
32
}
Original file line number Diff line number Diff line change 2
2
# Nitrobase file location specific to each owner id.
3
3
4
4
location ~ ^/$nitrobaseRegionPerOwner/[A-z0-9_=-]+/[A-z0-9_=-]+/ {
5
- if ($authUserToken = 0 ) {
5
+ if ($authUserToken = "" ) {
6
6
return 403; # User not defined
7
7
break;
8
8
}
You can’t perform that action at this time.
0 commit comments