Skip to content

Commit

Permalink
Hide settings that cant be changed
Browse files Browse the repository at this point in the history
  • Loading branch information
mickenordin committed Sep 5, 2024
1 parent f23cf20 commit 2485fd1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
9 changes: 8 additions & 1 deletion mfazones/lib/Controller/MfazonesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,18 @@ public function get(): JSONResponse
$type = $this->castObjectType($node->getType());
$result = $this->tagMapper->haveTag($node->getId(), $type, $tagId);

try {
$mfa_on_parent = $this->utils->nodeOrParentHasTag($node->getParent());
} catch (NotFoundException) {
$mfa_on_parent = false;
}

return new JSONResponse(
array(
'status' => $result,
'mfa_passed' => $this->isMfaVerified(),
'has_access' => $this->hasAccess($source)
'has_access' => $this->hasAccess($source),
'mfa_on_parent' => $mfa_on_parent
)
);
} catch (\Exception $e) {
Expand Down
14 changes: 11 additions & 3 deletions mfazones/src/views/MFATab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
<label for="enable-2fa-button">This is a mfazone that has been shared with you, so you can not change any settings
for it.</label><br><br>
</div>
<div id="not-owner" style="--icon-size:36px;" hidden>
<label for="enable-2fa-button">This is a mfazone that has been shared with you, so you can not change any settings for it.</label><br><br>
<div id="not-top" style="--icon-size:36px;" hidden>
<label for="enable-2fa-button">This is a mfazone that has been set further up in the file tree, you must go there
to change settings for it. But take this ⚔, it is dangerous to go alone.</label><br><br>
</div>
</NcActions>
</template>
Expand Down Expand Up @@ -92,15 +93,22 @@ export default {
var needMFA = document.getElementById('need-mfa');
var haveMFA = document.getElementById('have-mfa');
var notOwner = document.getElementById('not-owner');
var notTop = document.getElementById('not-top');
needMFA.hidden = true;
notOwner.hidden = true;
haveMFA.hidden = true;
notTop.hidden = true;
let mfa_passed = state.mfa_passed;
let status = state.status;
let has_access = state.has_access;
let mfa_on_parent = state.mfa_on_parent;
if (mfa_passed) {
if (has_access) {
haveMFA.hidden = false;
if (mfa_on_parent) {
notTop.hidden = false;
} else {
haveMFA.hidden = false;
}
} else {
notOwner.hidden = false;
}
Expand Down

0 comments on commit 2485fd1

Please sign in to comment.