File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,15 @@ Release notes
1717 Prior to this change only "superusers" could see and use this feature.
1818 https://github.com/aboutcode-org/dejacode/issues/385
1919
20+ - Add Dataspace FK validation on Dataspace and DejacodeUser models.
21+ Assigning an object from another Dataspace will raise an error at the ``save() ``
22+ level.
23+ Do not include the ``homepage_layout `` field on Dataspace "addition" form since the
24+ Dataspace does not exist yet.
25+ Display the ``homepage_layout `` field as read-only on the Dataspace and User change
26+ forms when the currently logged user is not looking at his own Dataspace.
27+ https://github.com/aboutcode-org/dejacode/issues/428
28+
2029### Version 5.4.2
2130
2231- Migrate the LDAP testing from using mockldap to slapdtest.
Original file line number Diff line number Diff line change @@ -204,6 +204,19 @@ def test_dataspace_admin_changeform_hide_dataspace_fk_on_addition(self):
204204 self .assertContains (response , expected1 )
205205 self .assertContains (response , expected2 )
206206
207+ def test_dataspace_admin_changeform_dataspace_fk_read_only_when_other_dataspace (self ):
208+ self .client .login (username = self .super_user .username , password = "secret" )
209+
210+ expected = "configuration-0-homepage_layout"
211+
212+ url = reverse ("admin:dje_dataspace_change" , args = [self .other_dataspace .pk ])
213+ response = self .client .get (url )
214+ self .assertNotContains (response , expected )
215+
216+ url = reverse ("admin:dje_dataspace_change" , args = [self .dataspace .pk ])
217+ response = self .client .get (url )
218+ self .assertContains (response , expected )
219+
207220 def test_dataspace_admin_changelist_missing_in_filter_availability (self ):
208221 # MissingInFilter is only available to superusers
209222 url = reverse ("admin:organization_owner_changelist" )
Original file line number Diff line number Diff line change @@ -428,6 +428,19 @@ def test_user_admin_hide_dataspace_fk_on_addition(self):
428428 self .assertContains (response , expected1 )
429429 self .assertContains (response , expected2 )
430430
431+ def test_user_admin_dataspace_fk_read_only_when_other_dataspace (self ):
432+ self .client .login (username = self .nexb_user .username , password = "secret" )
433+
434+ expected = "id_homepage_layout"
435+
436+ url = reverse ("admin:dje_dejacodeuser_change" , args = [self .other_user .pk ])
437+ response = self .client .get (url )
438+ self .assertNotContains (response , expected )
439+
440+ url = reverse ("admin:dje_dejacodeuser_change" , args = [self .nexb_user .pk ])
441+ response = self .client .get (url )
442+ self .assertContains (response , expected )
443+
431444 def test_user_admin_form_scope_homepage_layout_choices (self ):
432445 self .client .login (username = self .nexb_user .username , password = "secret" )
433446 url = reverse ("admin:dje_dejacodeuser_change" , args = [self .nexb_user .pk ])
You can’t perform that action at this time.
0 commit comments