MOBILE-4122 about: Check user role to hide survey

main
Alfonso Salces 2022-08-19 13:15:06 +02:00
parent e7b8a824c2
commit aac66014ec
3 changed files with 14 additions and 2 deletions

View File

@ -388,6 +388,16 @@ export class CoreSite {
this.oauthId = oauthId; this.oauthId = oauthId;
} }
/**
* Check if current user is Admin.
* Works properly since v3.8. See more in: {@link} https://tracker.moodle.org/browse/MDL-65550
*
* @returns Whether the user is Admin.
*/
isAdmin(): boolean {
return this.getInfo()?.userissiteadmin ?? false;
}
/** /**
* Check if the user authenticated in the site using an OAuth method. * Check if the user authenticated in the site using an OAuth method.
* *

View File

@ -27,8 +27,8 @@
<ion-icon name="fas-universal-access" slot="start" aria-hidden="true"></ion-icon> <ion-icon name="fas-universal-access" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.settings.accessstatement' | translate }}</ion-label> <ion-label>{{ 'core.settings.accessstatement' | translate }}</ion-label>
</ion-item> </ion-item>
<ion-item *ngIf="currentSite && feedbackFormUrl" class="ion-text-wrap" button core-link [href]="feedbackFormUrl" detail="true" <ion-item *ngIf="currentSite && feedbackFormUrl && showSurvey" class="ion-text-wrap" button core-link [href]="feedbackFormUrl"
detailIcon="open-outline"> detail="true" detailIcon="open-outline">
<ion-icon name="fas-bullhorn" slot="start" aria-hidden="true"></ion-icon> <ion-icon name="fas-bullhorn" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.settings.helpusimprove' | translate }}</ion-label> <ion-label>{{ 'core.settings.helpusimprove' | translate }}</ion-label>
</ion-item> </ion-item>

View File

@ -35,6 +35,7 @@ export class CoreSettingsAboutPage {
feedbackFormUrl = CoreConstants.CONFIG.feedbackFormUrl ?? 'https://feedback.moodle.org/mobileapp'; feedbackFormUrl = CoreConstants.CONFIG.feedbackFormUrl ?? 'https://feedback.moodle.org/mobileapp';
a11yStatement = CoreConstants.CONFIG.a11yStatement ?? 'https://apps.moodle.com/admin/tool/policy/view.php?versionid=5'; a11yStatement = CoreConstants.CONFIG.a11yStatement ?? 'https://apps.moodle.com/admin/tool/policy/view.php?versionid=5';
currentSite?: CoreSite; currentSite?: CoreSite;
showSurvey: boolean | undefined = false;
constructor() { constructor() {
this.currentSite = CoreSites.getCurrentSite(); this.currentSite = CoreSites.getCurrentSite();
@ -45,6 +46,7 @@ export class CoreSettingsAboutPage {
// Calculate the privacy policy to use. // Calculate the privacy policy to use.
this.privacyPolicy = (this.currentSite && (this.currentSite.getStoredConfig('tool_mobile_apppolicy') || this.privacyPolicy = (this.currentSite && (this.currentSite.getStoredConfig('tool_mobile_apppolicy') ||
this.currentSite.getStoredConfig('sitepolicy'))) || CoreConstants.CONFIG.privacypolicy; this.currentSite.getStoredConfig('sitepolicy'))) || CoreConstants.CONFIG.privacypolicy;
this.showSurvey = this.currentSite?.isAdmin();
} }
/** /**