summaryrefslogtreecommitdiffstats
path: root/ogcp/forms/action_forms.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-18 15:34:09 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-25 09:48:12 +0200
commitefd0b8acb3f4f098697c8c30bd196dacda39b704 (patch)
tree95959f7e437a531548de90b94ae00181175a04fc /ogcp/forms/action_forms.py
parent594d655d6b13edfd1885d555ecda1a6f912db501 (diff)
ogcp: add image restrict functionality
Add center scope restriction using /image/restrict. Add view in Images to update scope permissions. Disable images in Commands for image update and restore if the client belongs to a disabled center. Consolidate template code to render scope selection checkboxes.
Diffstat (limited to 'ogcp/forms/action_forms.py')
-rw-r--r--ogcp/forms/action_forms.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py
index e72e37c..82958fb 100644
--- a/ogcp/forms/action_forms.py
+++ b/ogcp/forms/action_forms.py
@@ -7,7 +7,8 @@
from wtforms import (
Form, SubmitField, HiddenField, SelectField, BooleanField, IntegerField,
- StringField, RadioField, FormField, FieldList, DecimalField, TextAreaField
+ StringField, RadioField, FormField, FieldList, DecimalField, TextAreaField,
+ SelectMultipleField
)
from wtforms.validators import InputRequired
from flask_wtf import FlaskForm
@@ -236,6 +237,20 @@ class ImageDetailsForm(FlaskForm):
permissions = StringField(label=_l('Permissions'))
software_id = StringField(label=_l('Software id'))
checksum = StringField(label=_l('Checksum'))
+ scopes = SelectMultipleField(
+ label=_l('Allowed scopes'),
+ description=_l('No scope selection gives full access'),
+ )
+
+class ImageConfigForm(FlaskForm):
+ image_id = HiddenField()
+ server = HiddenField()
+ name = HiddenField()
+ scopes = SelectMultipleField(
+ label=_l('Allowed scopes'),
+ description=_l('No scope selection gives full access'),
+ )
+ submit = SubmitField(label=_l('Submit'))
class ServerForm(FlaskForm):
name = StringField(label=_l('Name'),