<commit_before>/*!
    Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
    Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
    Created By: <EMAIL>
    Maintained By: <EMAIL>
*/

;(function(can) {
var ADMIN_PERMISSION
, _CONDITIONS_MAP = {
    contains: function(instance, args) {
      var value = _resolve_permission_variable(args.value);
      var list_value = instance[args.list_property];
      for (var i = 0; i < list_value.length; i++) {
        if (list_value[i].id == value.id) return true;
      }
      return false;
    }
    , is: function(instance, args) {
      var value = _resolve_permission_variable(args.value);
      var property_value = instance[args.property_name];
      return value == property_value;
    }
    , in: function(instance, args) {
      var value = _resolve_permission_variable(args.value);
      var property_value = instance[args.property_name];
      return value.indexOf(property_value) >= 0;
    }
  }
, permissions_compute = can.compute(GGRC.permissions);

can.Construct("Permission", {

  _admin_permission_for_context : function(context_id) {
    return new Permission(
      ADMIN_PERMISSION.action, ADMIN_PERMISSION.resource_type, context_id);
  }

  , _permission_match : function(permissions, permission) {
    var resource_types = permissions[permission.action] || {}
      , resource_type = resource_types[permission.resource_type] || {}
      , contexts = resource_type['contexts'] || []
      ;

    return (contexts.indexOf(permission.context_id) > -1);<commit_msg>b/12824882: fix canified Permissions condition map<commit_after>/*!
    Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
    Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
    Created By: <EMAIL>
    Maintained By: <EMAIL>
*/

;(function(can) {
var ADMIN_PERMISSION
, _CONDITIONS_MAP = {
    contains: function(instance, args) {
      var value = Permission._resolve_permission_variable(args.value);
      var list_value = instance[args.list_property];
      for (var i = 0; i < list_value.length; i++) {
        if (list_value[i].id == value.id) return true;
      }
      return false;
    }
    , is: function(instance, args) {
      var value = Permission._resolve_permission_variable(args.value);
      var property_value = instance[args.property_name];
      return value == property_value;
    }
    , in: function(instance, args) {
      var value = Permission._resolve_permission_variable(args.value);
      var property_value = instance[args.property_name];
      return value.indexOf(property_value) >= 0;
    }
  }
, permissions_compute = can.compute(GGRC.permissions);

can.Construct("Permission", {

  _admin_permission_for_context : function(context_id) {
    return new Permission(
      ADMIN_PERMISSION.action, ADMIN_PERMISSION.resource_type, context_id);
  }

  , _permission_match : function(permissions, permission) {
    var resource_types = permissions[permission.action] || {}
      , resource_type = resource_types[permission.resource_type] || {}
      , contexts = resource_type['contexts'] || []
      ;

    return (contexts.indexOf(permission.context_id) > -1);
{'fraction_non_alphanumeric': 0.11872287662740236, 'fraction_numerical': 0.008059516429014259, 'mean_word_length': 3.663294797687861, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7047042', 'n_tokens_mistral': 1004, 'n_tokens_neox': 971, 'n_words': 202}