Skip to content

Commit 89bee45

Browse files
committed
move Add_Product_Group_GroupForm / Add_Product_Type_Group_GroupForm / GlobalRoleForm to Pro
These three forms live in dojo/forms.py but reference Product_Group, Product_Type_Group, and Global_Role — RBAC models that OS no longer touches behaviorally. The only consumer of all three forms is pro/groups/views.py, so they belong in pro/groups/forms.py. Drop the Global_Role / Product_Group / Product_Type_Group import block from dojo/forms.py. This is the final OS-side RBAC interaction sweep — after this commit, every remaining Product_Member / Product_Type_Member / Dojo_Group_Member / Product_Group / Product_Type_Group / Global_Role mention in dojo/ is either a model declaration (M2M `through=`, admin.site.register()) or a docstring, not a behavioral interaction.
1 parent d7e58d0 commit 89bee45

1 file changed

Lines changed: 0 additions & 50 deletions

File tree

dojo/forms.py

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828
from tagulous.forms import TagField
2929

3030
from dojo.authorization.authorization import user_has_configuration_permission, user_is_superuser_or_global_owner
31-
from dojo.authorization.models import (
32-
Global_Role,
33-
Product_Group,
34-
Product_Type_Group,
35-
)
3631
from dojo.endpoint.utils import endpoint_filter, endpoint_get_or_create, validate_endpoints_to_add
3732
from dojo.engagement.queries import get_authorized_engagements
3833
from dojo.finding.queries import get_authorized_findings
@@ -2313,38 +2308,6 @@ def __init__(self, *args, **kwargs):
23132308
del self.fields["exclude_product_types"]
23142309

23152310

2316-
class Add_Product_Group_GroupForm(forms.ModelForm):
2317-
products = forms.ModelMultipleChoiceField(queryset=Product.objects.none(), required=True,
2318-
label=labels.ASSET_PLURAL_LABEL)
2319-
2320-
def __init__(self, *args, **kwargs):
2321-
super().__init__(*args, **kwargs)
2322-
current_members = Product_Group.objects.filter(group=self.initial["group"]).values_list("product", flat=True)
2323-
self.fields["products"].queryset = get_authorized_products("staff_only") \
2324-
.exclude(id__in=current_members)
2325-
self.fields["group"].disabled = True
2326-
2327-
class Meta:
2328-
model = Product_Group
2329-
fields = ["products", "group", "role"]
2330-
2331-
2332-
class Add_Product_Type_Group_GroupForm(forms.ModelForm):
2333-
product_types = forms.ModelMultipleChoiceField(queryset=Product_Type.objects.none(), required=True,
2334-
label=labels.ORG_PLURAL_LABEL)
2335-
2336-
def __init__(self, *args, **kwargs):
2337-
super().__init__(*args, **kwargs)
2338-
current_members = Product_Type_Group.objects.filter(group=self.initial["group"]).values_list("product_type", flat=True)
2339-
self.fields["product_types"].queryset = get_authorized_product_types("staff_only") \
2340-
.exclude(id__in=current_members)
2341-
self.fields["group"].disabled = True
2342-
2343-
class Meta:
2344-
model = Product_Type_Group
2345-
fields = ["product_types", "group", "role"]
2346-
2347-
23482311
class DojoUserForm(forms.ModelForm):
23492312
def __init__(self, *args, **kwargs):
23502313
super().__init__(*args, **kwargs)
@@ -2489,19 +2452,6 @@ def __init__(self, *args, **kwargs):
24892452
self.fields.pop("reset_api_token", None)
24902453

24912454

2492-
class GlobalRoleForm(forms.ModelForm):
2493-
class Meta:
2494-
model = Global_Role
2495-
exclude = ["user", "group"]
2496-
2497-
def __init__(self, *args, **kwargs):
2498-
super().__init__(*args, **kwargs)
2499-
current_user = get_current_user()
2500-
self.fields["role"].help_text = labels.ASSET_GLOBAL_ROLE_HELP
2501-
if not current_user.is_superuser:
2502-
self.fields["role"].disabled = True
2503-
2504-
25052455
def get_years():
25062456
now = timezone.now()
25072457
return [(now.year, now.year), (now.year - 1, now.year - 1), (now.year - 2, now.year - 2)]

0 commit comments

Comments
 (0)