- Added requiredPermissions to the application/config/udfmasterschema.json and set them as mandatory

- Removed the private method _isAllowed from application/controllers/widgets/UDF.php
- Removed required permissions from views application/views/system/fas_udf.php and application/views/system/infocenter/zgvpruefungen.php
- Widget views application/views/widgets/checkbox, dropdown, textarea and textfield now they print the attribute disabled
- Added constant DISABLED to application/widgets/html/HTMLWidget.php
- Removed private property _requiredPermissions from application/widgets/udf/UDFWidget.php
- application/widgets/udf/UDFWidget.php does not check permissions anymore and does not store them anymore
- Added constants PERMISSION_TYPE_READ and PERMISSION_TYPE_WRITE to application/libraries/UDFLib.php
- Removed constant PERMISSION_TYPE from application/libraries/UDFLib.php
- Removed public method isAllowed from application/libraries/UDFLib.php
- Added private methods _readAllowed, _writeAllowed, _setRequiredPermissions and _setReadOnly to application/libraries/UDFLib.php
- UDFLib->displayUDFWidget now checks if permissions are declared in the UDF JSON and if the user is allowed to read and write such UDF
- UDFLib->saveUDFs now checks if the user has the permissions to write such UDF
- Now the UDFs are even displayed in read only mode
This commit is contained in:
Paolo
2021-09-07 12:13:59 +02:00
parent 0099aaadb0
commit 9c84558f5f
11 changed files with 235 additions and 162 deletions
+1 -2
View File
@@ -45,7 +45,6 @@
echo $this->udflib->UDFWidget(
array(
UDFLib::UDF_UNIQUE_ID => 'fasPersonUDFs',
UDFLib::REQUIRED_PERMISSIONS_PARAMETER => 'basis/person',
UDFLib::SCHEMA_ARG_NAME => 'public',
UDFLib::TABLE_ARG_NAME => 'tbl_person',
UDFLib::PRIMARY_KEY_NAME => 'person_id',
@@ -70,7 +69,6 @@
echo $this->udflib->UDFWidget(
array(
UDFLib::UDF_UNIQUE_ID => 'fasPrestudentUDFs',
UDFLib::REQUIRED_PERMISSIONS_PARAMETER => 'basis/person',
UDFLib::SCHEMA_ARG_NAME => 'public',
UDFLib::TABLE_ARG_NAME => 'tbl_prestudent',
UDFLib::PRIMARY_KEY_NAME => 'prestudent_id',
@@ -109,3 +107,4 @@
</body>
<?php $this->load->view("templates/footer"); ?>
@@ -341,7 +341,6 @@
echo $this->udflib->UDFWidget(
array(
UDFLib::UDF_UNIQUE_ID => 'infocenterPrestudentUDFs_'.$zgvpruefung->prestudent_id,
UDFLib::REQUIRED_PERMISSIONS_PARAMETER => 'infocenter',
UDFLib::SCHEMA_ARG_NAME => 'public',
UDFLib::TABLE_ARG_NAME => 'tbl_prestudent',
UDFLib::PRIMARY_KEY_NAME => 'prestudent_id',
@@ -553,3 +552,4 @@
endforeach; // end foreach zgvpruefungen
?>
</div><!-- /.panel-group -->
+3 -1
View File
@@ -24,6 +24,7 @@
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::HTML_NAME); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::REQUIRED); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::TITLE); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::DISABLED, false); ?>
<?php
$checked = '';
if (${CheckboxWidget::VALUE_FIELD} === true)
@@ -38,4 +39,5 @@
</div>
</div>
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
+2
View File
@@ -33,6 +33,7 @@
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::MAX_VALUE); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::REGEX); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::TITLE); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::DISABLED, false); ?>
>
<?php
$elements = ${DropdownWidget::WIDGET_DATA_ELEMENTS_ARRAY_NAME};
@@ -72,3 +73,4 @@
</div>
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
+3 -1
View File
@@ -29,9 +29,11 @@
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::MAX_LENGTH); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::REGEX); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::TITLE); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::DISABLED, false); ?>
><?php echo ${TextareaWidget::TEXT}; ?></textarea>
</div>
</div>
</div>
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
+3 -1
View File
@@ -31,10 +31,12 @@
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::MAX_LENGTH); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::REGEX); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::TITLE); ?>
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::DISABLED, false); ?>
value="<?php echo ${TextfieldWidget::VALUE}; ?>"
>
</div>
</div>
</div>
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>