Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CloWM UI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computational Metagenomics
CloWM
CloWM UI
Commits
b4bf8b67
Verified
Commit
b4bf8b67
authored
2 years ago
by
Daniel Göbel
Browse files
Options
Downloads
Patches
Plain Diff
Disable features for buckets with constraints
#34
parent
dbf7d5b9
No related branches found
No related tags found
2 merge requests
!84
Remove development branch
,
!29
Resolve "Disable features for initial buckets"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/BucketView.vue
+3
-3
3 additions, 3 deletions
src/components/BucketView.vue
src/stores/buckets.ts
+63
-12
63 additions, 12 deletions
src/stores/buckets.ts
src/views/object-storage/BucketsView.vue
+1
-2
1 addition, 2 deletions
src/views/object-storage/BucketsView.vue
with
67 additions
and
17 deletions
src/components/BucketView.vue
+
3
−
3
View file @
b4bf8b67
...
@@ -637,7 +637,7 @@ watch(
...
@@ -637,7 +637,7 @@ watch(
<!-- Add bucket permission button -->
<!-- Add bucket permission button -->
<button
<button
v-if=
"!authStore.foreignUser"
v-if=
"!authStore.foreignUser"
:hidden=
"bucketRepository.
getBucketPermission
(props.bucketName)
!= null
"
:hidden=
"
!
bucketRepository.
permissionFeatureAllowed
(props.bucketName)"
type=
"button"
type=
"button"
class=
"btn btn-secondary m-2 tooltip-container"
class=
"btn btn-secondary m-2 tooltip-container"
:disabled=
"errorLoadingObjects"
:disabled=
"errorLoadingObjects"
...
@@ -669,7 +669,7 @@ watch(
...
@@ -669,7 +669,7 @@ watch(
/>
/>
<button
<button
v-if=
"!authStore.foreignUser"
v-if=
"!authStore.foreignUser"
:hidden=
"bucketRepository.
getBucketPermission
(props.bucketName)
!= null
"
:hidden=
"
!
bucketRepository.
permissionFeatureAllowed
(props.bucketName)"
type=
"button"
type=
"button"
class=
"btn btn-secondary m-2 tooltip-container"
class=
"btn btn-secondary m-2 tooltip-container"
:disabled=
"errorLoadingObjects"
:disabled=
"errorLoadingObjects"
...
@@ -852,7 +852,7 @@ watch(
...
@@ -852,7 +852,7 @@ watch(
<button
<button
class=
"dropdown-item"
class=
"dropdown-item"
type=
"button"
type=
"button"
:disabled=
"
!writableBucket ||
!readableBucket"
:disabled=
"!readableBucket"
data-bs-toggle=
"modal"
data-bs-toggle=
"modal"
data-bs-target=
"#copy-object-modal"
data-bs-target=
"#copy-object-modal"
@
click=
"objectState.copyObject = obj"
@
click=
"objectState.copyObject = obj"
...
...
This diff is collapsed.
Click to expand it.
src/stores/buckets.ts
+
63
−
12
View file @
b4bf8b67
import
{
defineStore
}
from
"
pinia
"
;
import
{
defineStore
}
from
"
pinia
"
;
import
{
BucketPermissionService
,
BucketService
}
from
"
@/client/s3proxy
"
;
import
{
BucketPermissionService
,
BucketService
,
Constraint
,
}
from
"
@/client/s3proxy
"
;
import
type
{
import
type
{
BucketOut
,
BucketOut
,
BucketIn
,
BucketIn
,
...
@@ -18,12 +22,33 @@ export const useBucketStore = defineStore({
...
@@ -18,12 +22,33 @@ export const useBucketStore = defineStore({
ownPermissions
:
Record
<
string
,
BucketPermissionOut
>
;
ownPermissions
:
Record
<
string
,
BucketPermissionOut
>
;
}),
}),
getters
:
{
getters
:
{
permissionFeatureAllowed
():
(
bucketName
:
string
)
=>
boolean
{
return
(
bucketName
)
=>
{
// If a permission for the bucket exist, then false
if
(
this
.
ownPermissions
[
bucketName
]
!=
null
)
{
return
false
;
}
const
bucket
=
this
.
buckets
.
find
((
b
)
=>
bucketName
==
b
.
name
);
// If the bucket doesn't exist, then false
if
(
bucket
==
null
)
{
return
false
;
}
// If there is a constraint on the bucket, then false otherwise true
return
bucket
.
owner_constraint
==
null
;
};
},
writableBuckets
():
BucketOut
[]
{
writableBuckets
():
BucketOut
[]
{
return
this
.
buckets
.
filter
(
return
this
.
buckets
.
filter
((
bucket
)
=>
{
(
bucket
)
=>
const
permission
=
this
.
ownPermissions
[
bucket
.
name
];
this
.
ownPermissions
[
bucket
.
name
]
===
undefined
||
if
(
permission
!=
null
)
{
this
.
ownPermissions
[
bucket
.
name
].
permission
!==
"
READ
"
return
permission
.
permission
!==
"
READ
"
;
);
}
// If the user owns the bucket, check the bucket constraint
return
(
bucket
.
owner_constraint
==
null
||
bucket
.
owner_constraint
==
Constraint
.
WRITE
);
});
},
},
getBucketPermission
():
(
getBucketPermission
():
(
bucketName
:
string
bucketName
:
string
...
@@ -31,14 +56,40 @@ export const useBucketStore = defineStore({
...
@@ -31,14 +56,40 @@ export const useBucketStore = defineStore({
return
(
bucketName
)
=>
this
.
ownPermissions
[
bucketName
];
return
(
bucketName
)
=>
this
.
ownPermissions
[
bucketName
];
},
},
writableBucket
():
(
bucketName
:
string
)
=>
boolean
{
writableBucket
():
(
bucketName
:
string
)
=>
boolean
{
return
(
bucketName
)
=>
return
(
bucketName
)
=>
{
this
.
ownPermissions
[
bucketName
]
===
undefined
||
// If this is a foreign bucket, check that the user has write permission
this
.
ownPermissions
[
bucketName
].
permission
!==
"
READ
"
;
const
permission
=
this
.
ownPermissions
[
bucketName
];
if
(
permission
!=
null
)
{
return
permission
.
permission
!==
"
READ
"
;
}
// If the user owns the bucket, check the bucket constraint
const
bucket
=
this
.
buckets
.
find
((
b
)
=>
bucketName
==
b
.
name
);
if
(
bucket
!=
null
)
{
return
(
bucket
.
owner_constraint
==
null
||
bucket
.
owner_constraint
==
Constraint
.
WRITE
);
}
return
false
;
};
},
},
readableBucket
():
(
bucketName
:
string
)
=>
boolean
{
readableBucket
():
(
bucketName
:
string
)
=>
boolean
{
return
(
bucketName
)
=>
return
(
bucketName
)
=>
{
this
.
ownPermissions
[
bucketName
]
===
undefined
||
// If this is a foreign bucket, check that the user has read permission
this
.
ownPermissions
[
bucketName
].
permission
!==
"
WRITE
"
;
const
permission
=
this
.
ownPermissions
[
bucketName
];
if
(
permission
!=
null
)
{
return
permission
.
permission
!==
"
WRITE
"
;
}
// If the user owns the bucket, check the bucket constraint
const
bucket
=
this
.
buckets
.
find
((
b
)
=>
bucketName
==
b
.
name
);
if
(
bucket
!=
null
)
{
return
(
bucket
.
owner_constraint
==
null
||
bucket
.
owner_constraint
==
Constraint
.
READ
);
}
return
false
;
};
},
},
},
},
actions
:
{
actions
:
{
...
...
This diff is collapsed.
Click to expand it.
src/views/object-storage/BucketsView.vue
+
1
−
2
View file @
b4bf8b67
...
@@ -60,7 +60,6 @@ onMounted(() => {
...
@@ -60,7 +60,6 @@ onMounted(() => {
<
template
>
<
template
>
<DeleteModal
<DeleteModal
v-if=
"!authStore.foreignUser"
modalID=
"delete-bucket-modal"
modalID=
"delete-bucket-modal"
:object-name-delete=
"bucketsState.potentialDeleteBucketName"
:object-name-delete=
"bucketsState.potentialDeleteBucketName"
:back-modal-id=
"undefined"
:back-modal-id=
"undefined"
...
@@ -148,7 +147,7 @@ onMounted(() => {
...
@@ -148,7 +147,7 @@ onMounted(() => {
:active=
"false"
:active=
"false"
:loading=
"true"
:loading=
"true"
:permission=
"undefined"
:permission=
"undefined"
:deletable=
"
!authStore.foreignU
se
r
"
:deletable=
"
fal
se"
:bucket=
"
{
:bucket=
"
{
name: '',
name: '',
description: '',
description: '',
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment