通过配置企业应用程序首选项(AirWatch)来检索MDM用户名 [英] Retrieving Username Through MDM by Configuring Enterprise App Preferences (AirWatch)

查看:1022
本文介绍了通过配置企业应用程序首选项(AirWatch)来检索MDM用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ionic / Cordova构建一个混合应用程序,并使用插件(



Root.plist源代码

 <?xml version =1.0encoding =UTF-8?& 
<!DOCTYPE plist PUBLIC - // Apple // DTD PLIST 1.0 // ENhttp://www.apple.com/DTDs/PropertyList-1.0.dtd\">
< plist version =1.0>
< dict>
< key> PreferenceSpecifiers< / key>
< array>
< dict>
< key>键< / key>
< string> AWUsername< / string>
< key> DefaultValue< / key>
< dict>
< key>值< / key>
< string> Test< / string>
< / dict>
< / dict>
< / array>
< / dict>
< / plist>

JS

  var retrieveUser = function(){
var prefs = window.plugins.appPreferences;
//prefs.fetch(ok,fail,'dict','key');
prefs.fetch(prefReadSucess,prefReadFailed,'AWUsername','AWUsername');

function prefReadSucess(value){
console.log(User:+ value);
DataTransfer.getUser(value);
}

function prefReadFailed(error){
console.log(Error:+ error);
DataTransfer.getUser(ANONYMOUS);
}
};

retrieveUser();

使用上面提到的代码,结果是我得到值Test填充。我尝试了许多变化的Root.plist文件,但似乎不能配对AirWatch应用程序配置键的位于Root.plist文件中的键。帮助将非常感谢!请让我知道我在做什么错误和/或如何解决这个问题。非常感谢!

解决方案

解决方案



经过几次尝试,我达到了一个工作版本。它似乎要求键被命名为com.apple.configuration.managed替换此值尚未工作到目前为止。无论如何,这是我做的:



AirWatch控制台



配置键: com.apple.configuration.managed

值类型:字符串

配置值:{DisplayName}



根.plist

 <?xml version =1.0encoding =UTF-8?> 
<!DOCTYPE plist PUBLIC - // Apple // DTD PLIST 1.0 // ENhttp://www.apple.com/DTDs/PropertyList-1.0.dtd\">
< plist version =1.0>
< dict>
< key> PreferenceSpecifiers< / key>
< array>
< dict>
< key>键< / key>
< string> com.apple.configuration.managed< / string>
< key> DefaultValue< / key>
< dict>
< key>值< / key>
< string> ANONYMOUS< / string>
< / dict>
< / dict>
< / array>
< / dict>
< / plist>

JS

  var retrieveUser = function(){
var prefs = window.plugins.appPreferences;
//prefs.fetch(ok,fail,'dict','key');
prefs.fetch(prefReadSucess,prefReadFailed,'com.apple.configuration.managed','com.apple.configuration.managed');

function prefReadSucess(value){
console.log(User:+ value);
DataTransfer.getUser(value);
}

function prefReadFailed(error){
console.log(Error:+ error);
DataTransfer.getUser(ANONYMOUS);
}
};

retrieveUser();

希望能帮助任何人寻求解决方案!


I am building a hybrid app with Ionic/Cordova and am using a plugin (https://github.com/apla/me.apla.cordova.app-preferences) to retrieve a username value from the Root.plist file contained in Settings.bundle.

I am having difficulty sending this value through AirWatch (MDM Solution) and then properly reading it during runtime. I am using the Application Configuration setting while deploying the app as shown below:

In the AirWatch Console:

Root.plist Source Code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PreferenceSpecifiers</key>
    <array>
        <dict>
            <key>Key</key>
            <string>AWUsername</string>
            <key>DefaultValue</key>
            <dict>
                <key>Value</key>
                <string>Test</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

JS

var retrieveUser = function () {
      var prefs = window.plugins.appPreferences;
      //prefs.fetch (ok, fail, 'dict', 'key');
      prefs.fetch(prefReadSucess, prefReadFailed, 'AWUsername', 'AWUsername');

      function prefReadSucess(value) {
          console.log("User: " + value);
          DataTransfer.getUser(value);
      }

      function prefReadFailed(error) {
          console.log("Error: " + error);
          DataTransfer.getUser("ANONYMOUS");
      }
   };

    retrieveUser();

With the code mentioned above, the result is that I get the value "Test" where the username should be populating. I have tried numerous variations in the Root.plist file but cannot seem to pair the AirWatch App Config Key to the key located in the Root.plist file. Help would be greatly appreciated! Please let me know what I am doing wrong and/or how I can fix this. Thanks!

解决方案

SOLUTION

After several attempts I have reached a working version. It seems to require that the key is named "com.apple.configuration.managed" Replacing this value has not worked so far. Anyways, here's how I did it:

AirWatch Console

Configuration Key: com.apple.configuration.managed
Value Type: String
Configuration Value: {DisplayName}

Root.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PreferenceSpecifiers</key>
    <array>
        <dict>
            <key>Key</key>
            <string>com.apple.configuration.managed</string>
            <key>DefaultValue</key>
            <dict>
                <key>Value</key>
                <string>ANONYMOUS</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

JS

var retrieveUser = function () {
      var prefs = window.plugins.appPreferences;
      //prefs.fetch (ok, fail, 'dict', 'key');
      prefs.fetch(prefReadSucess, prefReadFailed, 'com.apple.configuration.managed', 'com.apple.configuration.managed');

      function prefReadSucess(value) {
          console.log("User: " + value);
          DataTransfer.getUser(value);
      }

      function prefReadFailed(error) {
          console.log("Error: " + error);
          DataTransfer.getUser("ANONYMOUS");
      }
    };

    retrieveUser();

Hope that helps anyone seeking a solution!

这篇关于通过配置企业应用程序首选项(AirWatch)来检索MDM用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆