Преглед изворни кода

Implement readonly profile MDM key

Danilo Bargen пре 7 година
родитељ
комит
edbce68a68
2 измењених фајлова са 16 додато и 3 уклоњено
  1. 3 3
      src/controller_model/me.ts
  2. 13 0
      src/services/webclient.ts

+ 3 - 3
src/controller_model/me.ts

@@ -138,11 +138,11 @@ export class MeControllerModel implements threema.ControllerModel<threema.MeRece
     }
 
     /**
-     * Can this receiver be edited?
+     * The profile can be edited if there are no MDM restrictions.
      */
     public canEdit(): boolean {
-        // TODO: Restrictions regarding work?
-        return true;
+        const mdm: threema.MdmRestrictions = this.webClientService.appCapabilities.mdm;
+        return mdm === undefined || !mdm.readonlyProfile;
     }
 
     public canShowQr(): boolean {

+ 13 - 0
src/services/webclient.ts

@@ -2797,4 +2797,17 @@ export class WebClientService {
         this.titleService.updateUnreadCount(0);
     }
 
+    /**
+     * Return the configuration object from the client info data.
+     */
+    public get appConfig(): threema.AppConfig {
+        return this.clientInfo.configuration;
+    }
+
+    /**
+     * Return the capabilities object from the client info data.
+     */
+    public get appCapabilities(): threema.AppCapabilities {
+        return this.clientInfo.capabilities;
+    }
 }