File tree Expand file tree Collapse file tree 4 files changed +24
-5
lines changed Expand file tree Collapse file tree 4 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,9 @@ export default {
197
197
},
198
198
},
199
199
computed: {
200
+ user () {
201
+ return this .$store .state .user ;
202
+ },
200
203
tooltipLabel () {
201
204
if (this .isContainerApp ) {
202
205
return this .$t (" Import to CasaOS" );
@@ -274,7 +277,7 @@ export default {
274
277
},
275
278
276
279
showActionButton () {
277
- return this .canBeControlled && ! this .isUninstalling && ! this .isRebuilding ;
280
+ return this .canBeControlled && ! this .isUninstalling && ! this .isRebuilding && this . user . is_admin ;
278
281
},
279
282
280
283
isSystemApp () {
Original file line number Diff line number Diff line change 8
8
:label =" $t('DragIconsToSort')"
9
9
:title =" $t('Apps')"
10
10
></app-section-title-tip >
11
-
12
11
<b-dropdown
12
+ v-if =" user.is_admin"
13
13
ref =" cdro"
14
14
animation =" fade1"
15
15
aria-role =" menu"
38
38
<transition name =" fade" >
39
39
<draggable
40
40
v-model =" appList"
41
- :draggable =" draggable"
41
+ :draggable =" user.is_admin && draggable"
42
42
class =" grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 app-list contextmenu-canvas"
43
43
tag =" div"
44
44
v-bind =" dragOptions"
@@ -204,6 +204,9 @@ export default {
204
204
showDragTip () {
205
205
return this .draggable === " .handle" ;
206
206
},
207
+ user () {
208
+ return this .$store .state .user ;
209
+ },
207
210
},
208
211
async created () {
209
212
db = await openDB (" casaos" , " 1" , {
@@ -215,7 +218,7 @@ export default {
215
218
});
216
219
this .getNewAppIdsFromCustomStorage ();
217
220
this .getTipsStateFromCustomStorage ();
218
-
221
+ this . getUserInfo ();
219
222
this .isLoading = true ;
220
223
this .draggable = this .isMobile () ? " " : " .handle" ;
221
224
@@ -324,6 +327,15 @@ export default {
324
327
this .gpuAppList = [];
325
328
});
326
329
},
330
+ /**
331
+ * @description : Get user info
332
+ * @return {*} void
333
+ */
334
+ getUserInfo () {
335
+ this .$api .users .getUserInfo ().then ((res ) => {
336
+ this .$store .commit (" SET_USER" , res .data .data );
337
+ });
338
+ },
327
339
328
340
/**
329
341
* @description : Fetch the list of installed apps
Original file line number Diff line number Diff line change @@ -23,7 +23,10 @@ const mutations: MutationTree<State> = {
23
23
} ,
24
24
25
25
SET_USER ( state , user : User ) {
26
- state . user = user ;
26
+ state . user = {
27
+ ...user ,
28
+ is_admin : user . role === 'admin' ? true : false ,
29
+ } ;
27
30
} ,
28
31
29
32
SET_INIT_KEY ( state , key : string ) {
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export interface User {
8
8
role : string ;
9
9
updated_at : string ;
10
10
username : string ;
11
+ is_admin ?: boolean ;
11
12
}
12
13
13
14
export interface State {
You can’t perform that action at this time.
0 commit comments