OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview Behavior for policy controlled network properties. |
| 7 */ |
| 8 |
| 9 /** @polymerBehavior */ |
| 10 var CrPolicyNetworkBehavior = { |
| 11 /** |
| 12 * @param {!CrOnc.NetworkProperty|undefined} property |
| 13 * @return {boolean} True if the network propety is controlled by a policy |
| 14 * (either enforced or recommended). |
| 15 */ |
| 16 isNetworkPolicyControlled: function(property) { |
| 17 if (typeof property != 'object' || !property.Effective) |
| 18 return false; |
| 19 // Enforced |
| 20 var effective = property.Effective; |
| 21 if (effective == 'UserPolicy' || effective == 'DevicePolicy') |
| 22 return true; |
| 23 // Recommended |
| 24 if (property.hasOwnProperty('UserPolicy') || |
| 25 property.hasOwnProperty('DevicePolicy')) { |
| 26 return true; |
| 27 } |
| 28 return false; |
| 29 }, |
| 30 |
| 31 /** |
| 32 * @param {!CrOnc.NetworkProperty|undefined} property |
| 33 * @return {boolean} True if the network propety is controlled by a policy. |
| 34 */ |
| 35 isNetworkPolicyEnforced: function(property) { |
| 36 if (!this.isNetworkPolicyControlled(property)) |
| 37 return false; |
| 38 if (property.hasOwnProperty('UserEditable')) |
| 39 return !property.UserEditable; |
| 40 if (property.hasOwnProperty('DeviceEditable')) |
| 41 return !property.DeviceEditable; |
| 42 return true; |
| 43 }, |
| 44 |
| 45 |
| 46 }; |
OLD | NEW |