Skip to content

Commit

Permalink
Merge pull request #10081 from owncloud/enforced-for-capability
Browse files Browse the repository at this point in the history
refactor: create composable for password enforcement capability
  • Loading branch information
kulmann authored Nov 28, 2023
2 parents cb4d481 + 550a2c3 commit df1744b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
12 changes: 2 additions & 10 deletions packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import {
useCapabilityFilesSharingPublicCanEdit,
useCapabilityFilesSharingPublicCanContribute,
useCapabilityFilesSharingPublicAlias,
useCapabilityFilesSharingPublicPasswordEnforcedFor,
useAbility,
usePasswordPolicyService,
getDefaultLinkPermissions
Expand Down Expand Up @@ -229,6 +230,7 @@ export default defineComponent({
hasPublicLinkEditing: useCapabilityFilesSharingPublicCanEdit(),
hasPublicLinkContribute: useCapabilityFilesSharingPublicCanContribute(),
hasPublicLinkAliasSupport: useCapabilityFilesSharingPublicAlias(),
passwordEnforced: useCapabilityFilesSharingPublicPasswordEnforcedFor(),
indirectLinkListCollapsed,
linkListCollapsed,
outgoingLinks,
Expand Down Expand Up @@ -292,16 +294,6 @@ export default defineComponent({
}
},
passwordEnforced() {
return (
this.capabilities.files_sharing.public.password?.enforced_for || {
read_only: false,
upload_only: false,
read_write: false
}
)
},
helpersEnabled() {
return this.configuration?.options?.contextHelpers
},
Expand Down
13 changes: 8 additions & 5 deletions packages/web-client/src/ocs/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ export interface PasswordPolicyCapability {
min_special_characters?: number
}

export interface PasswordEnforcedForCapability {
read_only?: boolean
read_write?: boolean
upload_only?: boolean
read_write_delete?: boolean
}

export interface LastModifiedFilterCapability {
keywords?: string[]
enabled?: boolean
Expand Down Expand Up @@ -100,11 +107,7 @@ export interface Capabilities {
multiple: boolean
password: {
enforced: boolean
enforced_for: {
read_only: boolean
read_write: boolean
upload_only: boolean
}
enforced_for: PasswordEnforcedForCapability
}
send_mail: boolean
supports_upload_only: boolean
Expand Down
13 changes: 12 additions & 1 deletion packages/web-pkg/src/composables/capability/useCapability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
AppProviderCapability,
LastModifiedFilterCapability,
MediaTypeCapability,
PasswordPolicyCapability
PasswordPolicyCapability,
PasswordEnforcedForCapability
} from '@ownclouders/web-client/src/ocs/capabilities'
import { SharePermissionBit } from '@ownclouders/web-client/src/helpers'

Expand Down Expand Up @@ -153,3 +154,13 @@ export const useCapabilitySearchMediaType = createCapabilityComposable<MediaType
'search.property.mediatype',
{}
)

export const useCapabilityFilesSharingPublicPasswordEnforcedFor =
createCapabilityComposable<PasswordEnforcedForCapability>(
'files_sharing.public.password.enforced_for',
{
read_only: false,
upload_only: false,
read_write: false
}
)

0 comments on commit df1744b

Please sign in to comment.