Skip to content

Check expiry enforcement for all share types - #40933

Merged
come-nc merged 3 commits into
masterfrom
check-datemax-enforcement-pubshare
Oct 23, 2023
Merged

Check expiry enforcement for all share types#40933
come-nc merged 3 commits into
masterfrom
check-datemax-enforcement-pubshare

Conversation

@nfebe

Copy link
Copy Markdown
Contributor

We should check that a maximum expiry date has been enforced for all shares and NOT JUST FOR internal shares before enforcing a UI max date, like in commit 9757e68

Resolves : no issue

@nfebe
nfebeforce-pushed the check-datemax-enforcement-pubshare branch from 8ef3748 to 3f51b16CompareOctober 16, 2023 15:28

@come-nccome-nc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enforcing now works for all three kind of shares.

But default seems broken for remote share it’s not applied?

@nfebe

Copy link
Copy Markdown
ContributorAuthor

Enforcing now works for all three kind of shares.

But default seems broken for remote share it’s not applied?

Added commit to fix it. Which also turns addresses and issue that existing of not being able to not set default if desired. Thanks @come-nc

@nfebe
nfebeforce-pushed the check-datemax-enforcement-pubshare branch 2 times, most recently from 2eda6db to 5840ca5CompareOctober 17, 2023 07:57
@szaimen
szaimen removed their request for review October 17, 2023 11:00
@come-nc

Copy link
Copy Markdown
Contributor

Hum, forced default expiration date now works for all cases, but for default value it uses the normal share default value for all 3 cases, even email and remote share, which should use their own default.

Comment threadapps/files_sharing/src/views/SharingDetailsTab.vue Outdated
Comment threadapps/files_sharing/src/views/SharingDetailsTab.vue Outdated
@nfebe
nfebeforce-pushed the check-datemax-enforcement-pubshare branch 5 times, most recently from 1fd800a to 420c0d9CompareOctober 19, 2023 17:35
@nfebe
nfebe requested a review from come-ncOctober 19, 2023 17:35
@come-nc

Copy link
Copy Markdown
Contributor

I had to run «npm run build» to fix the admin UI, so something is fishy in the commited dist. You will have to rebase on master and rebuild anyway.

Also, there is a problem:

  1. Set a default expiration date on all 3 types
  2. Force it for email share and not for the others
  3. Share with a user
  4. Date is enforced while it should not

Please test thoroughly requesting for review again.

@come-nccome-nc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enforcing is not working correctly (enforcing email enforces for local share, did not test other combinations)

@nfebe

nfebe commented Oct 20, 2023

Copy link
Copy Markdown
ContributorAuthor

I had to run «npm run build» to fix the admin UI, so something is fishy in the commited dist. You will have to rebase on master and rebuild anyway.

Sorry @come-nc it appears, a merge conflict resolution overwrote some of the updates, during a rebase.

@nfebe

nfebe commented Oct 20, 2023

Copy link
Copy Markdown
ContributorAuthor

Also, there is a problem:

Set a default expiration date on all 3 types
Force it for email share and not for the others
Share with a user
Date is enforced while it should not

Please test thoroughly requesting for review again.

About the defaultExpirationDate being enforced on all types, that was a known behavior which I added intentionally in :#40500

It is now clear that this variable was poorly named. If we have defaultRemoteExpirationDate, defaultInternalExpirationDate then it sounds like defaultExpirationDate is a general default and not defaultPublicExpirationDate so this did not appear like an off behavior but like a fallback default in case all the others are not set.

@nfebe
nfebeforce-pushed the check-datemax-enforcement-pubshare branch from 420c0d9 to e07d8e8CompareOctober 20, 2023 09:41
@nfebe
nfebe requested a review from come-ncOctober 20, 2023 09:44

@come-nccome-nc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

@nfebe
nfebeforce-pushed the check-datemax-enforcement-pubshare branch from e07d8e8 to d6ff703CompareOctober 20, 2023 12:36
@nfebe
nfebe enabled auto-merge October 20, 2023 12:37
@nextcloud-command
nextcloud-commandforce-pushed the check-datemax-enforcement-pubshare branch from d6ff703 to 4548fdbCompareOctober 20, 2023 12:51
@nfebe
nfebeforce-pushed the check-datemax-enforcement-pubshare branch from 4548fdb to a212ea9CompareOctober 22, 2023 08:44
@nfebe

Copy link
Copy Markdown
ContributorAuthor

/compile amend /

We should check that a maximum expiry date has been enforced for
all shares and NOT JUST FOR internal shares before enforcing a UI max date,
like in commit 9757e68
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Current expiration date errorneously assumes that `defaultExpirationDate`
applies to all kinds of shares. But it only really applies to public shares despite
its name.
This commit, fixes that by paring expiration dates with the correct share types during
new share initialization and simplifying the `hasExpirationDate` (check) property.
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
@nfebe
nfebeforce-pushed the check-datemax-enforcement-pubshare branch from a212ea9 to 2ca8561CompareOctober 22, 2023 14:48
@nfebe

Copy link
Copy Markdown
ContributorAuthor

/compile amend /

@nextcloud-command
nextcloud-commandforce-pushed the check-datemax-enforcement-pubshare branch from 2ca8561 to eb0c923CompareOctober 22, 2023 15:39
@nfebe
nfebeforce-pushed the check-datemax-enforcement-pubshare branch from eb0c923 to 2ca8561CompareOctober 22, 2023 16:12
@nfebe

Copy link
Copy Markdown
ContributorAuthor

/compile amend /

`isDefaultExpireDateEnforced` and its corresponding `defaultExpirationDate`
is currently treated as the enforcement fallback when share type enforcements are not
set.
However, `isDefaultExpireDateEnforced` and `defaultExpirationDate` are actually more like
`isDefaultPublicExpireDateEnforced` and `defaultPublicExpirationDate` and therefore only applies
to public shares.
It might be ideal to rename this variables all the way from the backend config to the way we use
them in the frontend code.
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@nextcloud-command
nextcloud-commandforce-pushed the check-datemax-enforcement-pubshare branch from 2ca8561 to 8dfcf2eCompareOctober 22, 2023 16:47
@come-nc
come-nc disabled auto-merge October 23, 2023 07:32
@come-nc
come-nc merged commit 6114364 into masterOct 23, 2023
@come-nc
come-nc deleted the check-datemax-enforcement-pubshare branch October 23, 2023 07:32
@nfebenfebe linked an issue Oct 24, 2023 that may be closed by this pull request
8 tasks
@marcelklehr

Copy link
Copy Markdown
Member

Can we please backport this to stable27?

@susnux

Copy link
Copy Markdown
Contributor

Looks like this is already on stable27? At least when I cherry pick it is empty. cc @fenn-cs

@nfebe

Copy link
Copy Markdown
ContributorAuthor

@susnux it is : #40928

@marcelklehr

Copy link
Copy Markdown
Member

#40928 says it's a backport of #40927 though and not of this #40933 ?

@nfebe

nfebe commented Dec 13, 2023

Copy link
Copy Markdown
ContributorAuthor

@marcelklehr it has commits from both pr's.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsfeature: sharing

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug]: New share dialog, can't unckek expire date [Bug]: share-expiration-calendar broken

6 participants

@nfebe@come-nc@marcelklehr@susnux@artonge@nickvergessen