File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed
Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 243243
244244<script >
245245import { api } from ' @/api'
246+ import { isAdmin , isAdminOrDomainAdmin } from ' @/role'
246247import Status from ' @/components/widgets/Status'
247248import TooltipButton from ' @/components/widgets/TooltipButton'
248249import TooltipLabel from ' @/components/widgets/TooltipLabel'
@@ -344,21 +345,29 @@ export default {
344345 })
345346 },
346347 fetchTemplateData () {
347- api (' listTemplates' , {
348- templatefilter: ' all' ,
348+ const params = {
349349 listall: ' true' ,
350350 domainid: this .resource .domainid ,
351351 account: this .resource .account
352- }).then (json => {
352+ }
353+ if (isAdmin ()) {
354+ params .templatefilter = ' all'
355+ } else {
356+ params .templatefilter = ' executable'
357+ }
358+ api (' listTemplates' , params).then (json => {
353359 this .templatesList = json .listtemplatesresponse ? .template || []
354360 })
355361 },
356362 fetchServiceOfferingData () {
357- api ( ' listServiceOfferings ' , {
363+ const params = {
358364 listall: ' true' ,
359- isrecursive: ' true' ,
360365 issystem: ' false'
361- }).then (json => {
366+ }
367+ if (isAdminOrDomainAdmin ()) {
368+ params .isrecursive = ' true'
369+ }
370+ api (' listServiceOfferings' , params).then (json => {
362371 this .serviceOfferingsList = json .listserviceofferingsresponse ? .serviceoffering || []
363372 this .serviceOfferingsList = this .serviceOfferingsList .filter (offering => ! offering .iscustomized )
364373 })
Original file line number Diff line number Diff line change @@ -1652,7 +1652,7 @@ export default {
16521652 if (this .templateId ) {
16531653 apiName = ' listTemplates'
16541654 params .listall = true
1655- params .templatefilter = ' all'
1655+ params .templatefilter = this . isNormalAndDomainUser ? ' executable ' : ' all'
16561656 params .id = this .templateId
16571657 } else if (this .networkId ) {
16581658 params .listall = true
Original file line number Diff line number Diff line change @@ -1619,11 +1619,11 @@ export default {
16191619 if (this .templateId ) {
16201620 apiName = ' listTemplates'
16211621 params .listall = true
1622- params .templatefilter = ' all'
1622+ params .templatefilter = this . isNormalAndDomainUser ? ' executable ' : ' all'
16231623 params .id = this .templateId
16241624 } else if (this .isoId ) {
16251625 params .listall = true
1626- params .isofilter = ' all'
1626+ params .isofilter = this . isNormalAndDomainUser ? ' executable ' : ' all'
16271627 params .id = this .isoId
16281628 apiName = ' listIsos'
16291629 } else if (this .networkId ) {
You can’t perform that action at this time.
0 commit comments