MOBILE-4122 about: Check user role to hide survey
parent
e7b8a824c2
commit
aac66014ec
|
@ -388,6 +388,16 @@ export class CoreSite {
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
<ion-icon name="fas-universal-access" slot="start" aria-hidden="true"></ion-icon>
|
||||
<ion-label>{{ 'core.settings.accessstatement' | translate }}</ion-label>
|
||||
</ion-item>
|
||||
<ion-item *ngIf="currentSite && feedbackFormUrl" class="ion-text-wrap" button core-link [href]="feedbackFormUrl" detail="true"
|
||||
detailIcon="open-outline">
|
||||
<ion-item *ngIf="currentSite && feedbackFormUrl && showSurvey" class="ion-text-wrap" button core-link [href]="feedbackFormUrl"
|
||||
detail="true" detailIcon="open-outline">
|
||||
<ion-icon name="fas-bullhorn" slot="start" aria-hidden="true"></ion-icon>
|
||||
<ion-label>{{ 'core.settings.helpusimprove' | translate }}</ion-label>
|
||||
</ion-item>
|
||||
|
|
|
@ -35,6 +35,7 @@ export class CoreSettingsAboutPage {
|
|||
feedbackFormUrl = CoreConstants.CONFIG.feedbackFormUrl ?? 'https://feedback.moodle.org/mobileapp';
|
||||
a11yStatement = CoreConstants.CONFIG.a11yStatement ?? 'https://apps.moodle.com/admin/tool/policy/view.php?versionid=5';
|
||||
currentSite?: CoreSite;
|
||||
showSurvey: boolean | undefined = false;
|
||||
|
||||
constructor() {
|
||||
this.currentSite = CoreSites.getCurrentSite();
|
||||
|
@ -45,6 +46,7 @@ export class CoreSettingsAboutPage {
|
|||
// Calculate the privacy policy to use.
|
||||
this.privacyPolicy = (this.currentSite && (this.currentSite.getStoredConfig('tool_mobile_apppolicy') ||
|
||||
this.currentSite.getStoredConfig('sitepolicy'))) || CoreConstants.CONFIG.privacypolicy;
|
||||
this.showSurvey = this.currentSite?.isAdmin();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue