Skip to content

Commit 0463537

Browse files
committed
style: mdformat fixes
1 parent bb25137 commit 0463537

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

docs/architecture/technical-details-of-permission-for-user-fields.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Terminology:
22

3-
- user row: a user row refers to a row being updated. Row is redundant but included to
3+
- user row: a user row refers to a row being updated. Row is redundant but included to
44
help distinguish between row and field level security.
55
- team mate: a user assigned through UserPermission to the same project as another user
66
- any team member: a user assigned to a project through UserPermission
@@ -11,14 +11,14 @@
1111

1212
### Source of Privileges
1313

14-
Field level security specifics are derived from u[cru.py](../../app/core/cru_permissions.py). The file includes several lists that
15-
you can use to derive different privileges. Search for these terms
14+
Field level security specifics are derived from u[cru.py](../../app/core/cru_permissions.py). The file includes several lists that
15+
you can use to derive different privileges. Search for these terms
1616

1717
- `_cru_permissions[profile_value]`
1818
- `_cru_permissions[member_project]`
1919
- `_cru_permissions[practice_lead_project]`
2020
- `_cru_permissions[admin_global]`
21-
fields followed by CRU or a subset of CRU for Create/Read/Update. Example:
21+
fields followed by CRU or a subset of CRU for Create/Read/Update. Example:
2222
`first_name:["RU"]` for a list would indicate that first name is readable and updateable
2323
for the list.
2424

@@ -40,15 +40,15 @@ The following API endpoints retrieve users:
4040

4141
- /user end point:
4242
- Global admins can read, update, and create fields specified in
43-
[cru.py](../../app/core/cru.py). Search for
43+
[cru.py](../../app/core/cru.py). Search for
4444
`_user_permissions[admin_global]`).
4545

4646
- Project admins can read and update fields specified in
4747
[cru.py](../../app/core/cru.py) for other project leads.\
4848
Search for for `_user_permissions[admin_project]` in [cru.py](../../app/core/cru.py)
4949

5050
- Practice area leads can read and update fields specified in
51-
[cru.py](../../app/core/cru.py) for fellow team members. If
51+
[cru.py](../../app/core/cru.py) for fellow team members. If
5252
the team member is in the same practice area,\
5353
Search for for `_user_permissions[practice_lead_project]` in [cru.py](../../app/core/cru.py)
5454

@@ -66,7 +66,7 @@ The following API endpoints retrieve users:
6666

6767
#### /me endpoint functionality
6868

69-
Used for reading and updating information about the user that is logged in. User permission assignments do not apply.
69+
Used for reading and updating information about the user that is logged in. User permission assignments do not apply.
7070

7171
- Row Level Security: Logged in user can always read and update their own information.
7272
- Field Level Security: For read and update permissions, see `_cru_permissions[profile_value]` in [cru.py](../../app/core/cru.py).
@@ -79,7 +79,7 @@ This is covered by issue #394.
7979

8080
##### Field level specifics / cru.py
8181

82-
The implemented field level security specifics can be derived from [cru.py](../../app/core/cru.py) and should match the requirements. If field privileges change or the requirements
82+
The implemented field level security specifics can be derived from [cru.py](../../app/core/cru.py) and should match the requirements. If field privileges change or the requirements
8383
don't match what is implemented this can be fixed by changing [cru.py](../../app/core/cru.py).
8484

8585
##### /user endpoint technical implementation
@@ -88,41 +88,41 @@ don't match what is implemented this can be fixed by changing [cru.py](../../app
8888
**serializers.py, permission_check.py**
8989
- get (read)
9090
- /user - see above bullet about response fields.
91-
- /user/<uuid> fetches a specific user. See above bullet about response fields. If the requesting_user does not have permission
91+
- /user/<uuid> fetches a specific user. See above bullet about response fields. If the requesting_user does not have permission
9292
to view the user, PermisssionUtil.get_user_read_fields will find no fields to serialize and throw a ValidationError
9393
- patch (update): `UserViewSet.partial_update` => `UserValidation.validate_patch_request(request)`.\
9494
validate_user_fields_patchable(requesting_user, response_related_user, request_fields)\` will compare request fields
95-
against `cru.user_post_fields[admin_global]` which is derived from `_cru_permissions`. If the request fields
95+
against `cru.user_post_fields[admin_global]` which is derived from `_cru_permissions`. If the request fields
9696
include a field outside the requesting_user's scope, the method returns a PermissionError, otherwise the
97-
record is udated. **views.py, permission_check.py**
97+
record is udated. **views.py, permission_check.py**
9898
- post (create): UserViewSet.create: If the requesting_user is not a global admin, the create method
9999
will throw an error. Calls UserValidation.validate_user_fields_postable which compares
100100
pe **views.py**
101101

102102
##### /me end point technical implementation
103103

104104
- response fields for get and patch: `UserProfileAPISerializer.to_representation` => `UserValidation.get_user_read_fields` determines which fields are serialized.
105-
- get: see response fields above. No request fields accepted. **views.py, serializer.py**
105+
- get: see response fields above. No request fields accepted. **views.py, serializer.py**
106106
- patch (update): By default, calls super().update_partial of UserProfileAPIView for
107-
the requesting user to update themselves. **views.py, serializer.py**
108-
- post (create): not applicable. Prevented by setting http_method_names in
109-
UserProfileAPIView to \["patch", "get"\]
107+
the requesting user to update themselves. **views.py, serializer.py**
108+
- post (create): not applicable. Prevented by setting http_method_names in
109+
UserProfileAPIView to ["patch", "get"]
110110

111111
#### Supporting Files
112112

113-
Documentation is generated by pydoc package. pydoc reads comments between triple quotes. See Appendix A.
113+
Documentation is generated by pydoc package. pydoc reads comments between triple quotes. See Appendix A.
114114

115115
- [permission_check.html](./docs/pydoc/permission_check.html)
116116
- [permission_fields.py](./docs/pydoc/http_method_field_permissions.html) => called from permission_check to
117-
determine permissiable fields. permission_fields.py derives permissable fields from
117+
determine permissiable fields. permission_fields.py derives permissable fields from
118118
user_permission_fields.
119119
- user_permission_fields_constants.py => see permission_fields.py
120120
- constants.py => holds constants for permission types.
121121
- urls.py
122122

123123
### Test Technical Details
124124

125-
Details of the purpose of each test and supporting code can be found in the the docs/pydoc documentation. Additional methods are automatically called based on the name
125+
Details of the purpose of each test and supporting code can be found in the the docs/pydoc documentation. Additional methods are automatically called based on the name
126126
of the method.
127127

128128
### Appendix A - Generate pydoc Documentation
@@ -132,20 +132,20 @@ of the method.
132132
pydoc documentation are located between triple quotes.
133133

134134
- See https://realpython.com/documenting-python-code/#docstring-types for format for creating class, method,
135-
or module pydoc. For documenting specific variables, you can do this as part of the class, method,
135+
or module pydoc. For documenting specific variables, you can do this as part of the class, method,
136136
or module documentation.
137137
- Check the file is included in documentation.py
138138
- After making the change, generate as explained below.
139139

140140
#### Modifying pydoc Documentation
141141

142-
Look for documentation between triple quotes. Modify the documentation, then generate as explained
142+
Look for documentation between triple quotes. Modify the documentation, then generate as explained
143143
below.
144144

145145
#### Generating pydoc Documentation
146146

147-
From Docker screen, locate web container. Select option to open terminal. To run locally, open local
148-
terminal. From terminal:
147+
From Docker screen, locate web container. Select option to open terminal. To run locally, open local
148+
terminal. From terminal:
149149

150150
```
151151
cd app

docs/contributing/howto/implement-user-based-security.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- **one-to-many user-related data access policy:** policy for tables where each row in the table is related to one and only one user, directly or indirectly.
44
- **authorization data access policy:** policy that requires authorization for create, update, delete and optionally read access.
5-
- **other data access policy:** any custom policy not covered by the previous two polices. For example, data access policy for create, update, and delete could be based on Djano roles. In that scenario, a specific table might only be updateable by a user with a specific Django role.
5+
- **other data access policy:** any custom policy not covered by the previous two polices. For example, data access policy for create, update, and delete could be based on Djano roles. In that scenario, a specific table might only be updateable by a user with a specific Django role.
66

77
## One-to-many user related data policy
88

@@ -30,7 +30,7 @@ A table that requires a user related data policy must have "user" as a field tha
3030

3131
### Record security
3232

33-
- determines whether a specific record can be viewed, updated, or created. If the table requires field level security then implementing record level security is not required.
33+
- determines whether a specific record can be viewed, updated, or created. If the table requires field level security then implementing record level security is not required.
3434
- implementation:
3535
- modify views.py
3636
- find `<table>ViewSet`
@@ -64,7 +64,7 @@ A table that requires a user related data policy must have "user" as a field tha
6464

6565
## Authorization data access policy
6666

67-
For many tables, create, update, and delete for all rows in the table are allowed if the request is from an authenticated user. Ability to read all rows may or may not require authentication. To implement one of these
67+
For many tables, create, update, and delete for all rows in the table are allowed if the request is from an authenticated user. Ability to read all rows may or may not require authentication. To implement one of these
6868
options modify view.py:
6969

7070
- find `<table>ViewSet`
@@ -92,15 +92,15 @@ The following API endpoints retrieve users:
9292

9393
- /user end point:
9494
- Global admins can read, update, and create fields specified in
95-
[cru.py](../../app/core/cru.py). Search for
95+
[cru.py](../../app/core/cru.py). Search for
9696
`_user_permissions[admin_global]`).
9797

9898
- Project admins can read and update fields specified in
9999
[cru.py](../../app/core/cru.py) for other project leads.\
100100
Search for for `_user_permissions[admin_project]` in [cru.py](../../app/core/cru.py)
101101

102102
- Practice area leads can read and update fields specified in
103-
[cru.py](../../app/core/cru.py) for fellow team members. If
103+
[cru.py](../../app/core/cru.py) for fellow team members. If
104104
the team member is in the same practice area,\
105105
Search for for `_user_permissions[practice_lead_project]` in [cru.py](../../app/core/cru.py)
106106

@@ -118,7 +118,7 @@ The following API endpoints retrieve users:
118118

119119
#### /me endpoint functionality
120120

121-
Used for reading and updating information about the user that is logged in. User permission assignments do not apply.
121+
Used for reading and updating information about the user that is logged in. User permission assignments do not apply.
122122

123123
- Row Level Security: Logged in user can always read and update their own information.
124124
- Field Level Security: For read and update permissions, see `_cru_permissions[profile_value]` in [cru.py](../../app/core/cru.py).

0 commit comments

Comments
 (0)