Reindex object security after user linking
164022
def _recursive_reindex_object_security(self, obj):
        
        if hasattr(aq_base(obj), "objectValues"):
            for obj in obj.objectValues():
                self._recursive_reindex_object_security(obj)

        logger.debug("Reindexing object security for {}".format(repr(obj)))
        obj.reindexObjectSecurity()
8825
public static function reIndex() {
    $fields = func_get_args();
    $array = array_shift($fields);
    $array = (array) $array;
    
    $R = array();
    foreach ($array as $obj) {
      $target =& $R;
      
      foreach ($fields as $field) {
        if (! array_key_exists($field, $obj)) die("reIndex: array doesn't have requested field\n");
        
        $nextkey = $obj[$field];
        $target =& $target[$nextkey];
      }
      $target = $obj;
    }
    return $R;
  }
464047
private Object sawLoad(int seen, Object userObject) {
        int reg = RegisterUtils.getALoadReg(this, seen);
        if (localSpecialObjects.containsKey(Integer.valueOf(reg))) {
            return Integer.valueOf(reg);
        }
        return userObject;
    }
586144
public int reindex(String sourceIndex, String sourceType, String targetIndex) throws IOException {
        logger.debug("reindex [{}]/[{}] -> [{}]/[doc]", sourceIndex, sourceType, targetIndex);

        String reindexQuery = "{  \"source\": {\n" +
                "    \"index\": \"" + sourceIndex + "\",\n" +
                "    \"type\": \"" + sourceType + "\"\n" +
                "  },\n" +
                "  \"dest\": {\n" +
                "    \"index\": \"" + targetIndex + "\",\n" +
                "    \"type\": \"doc\"\n" +
                "  }\n" +
                "}\n";

        logger.trace("{}", reindexQuery);

        Request request = new Request("POST", "/_reindex");
        request.setJsonEntity(reindexQuery);

        Response restResponse = client.getLowLevelClient().performRequest(request);
        Map<String, Object> response = asMap(restResponse);
        logger.debug("reindex response: {}", response);

        return (int) response.get("total");
    }
1310640
def user_update(object_id, input_params={}, always_retry=False, **kwargs):
    
    return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs)
1055498
function rebindCallback(target, source, postSetCallback) {
  var i = 2, n = arguments.length, method;
  while (++i < n) target[method = arguments[i]] = doRebind(target, source, source[method], postSetCallback);
  return target;
}
126276
def reindex_client_local_owner_permissions(portal):
    
    start = time.time()
    bsc = portal.bika_setup_catalog
    uids = [c.UID() for c in portal.clients.objectValues()]
    brains = bsc(getClientUID=uids)
    total = len(brains)
    for num, brain in enumerate(brains):
        ob = brain.getObject()
        logger.info("Reindexing permission for {}/{} ({})"
                    .format(num, total, ob.absolute_url()))
        ob.reindexObjectSecurity()
    end = time.time()
    logger.info("Fixing local owner role on client objects took {:.2f}s"
                .format(end-start))
    transaction.commit()
595968
def _delLocalOwnerRole(self, username):
        
        parent = self.getParent()
        if parent.portal_type == "Client":
            parent.manage_delLocalRoles([username])
            # reindex object security
            self._recursive_reindex_object_security(parent)
838204
public function reindex(): void
    {
        $this->index = [];
        $files = $this->scanDirectory($this->sourceDir, LabelIndex::RELATIVE_ROOT);

        foreach ($files as $file) {
            $node = $this->createIndexNode($file);
            $this->index[$node->getKey()] = $node;
        }

        $this->status = IndexInterface::STATUS_REINDEX;
    }
1088822
private void storeAndLinkOneToOne(boolean onlyLink, Object obj, ClassDescriptor cld,
                                      ObjectReferenceDescriptor rds, boolean insert)
    {
        Object ref = rds.getPersistentField().get(obj);
        if (!onlyLink && rds.getCascadingStore() == ObjectReferenceDescriptor.CASCADE_OBJECT)
        {
            if(rds.isSuperReferenceDescriptor())
            {
                ClassDescriptor superCld = rds.getClassDescriptor().getSuperClassDescriptor();
                Identity oid = serviceIdentity().buildIdentity(superCld, ref);
                storeToDb(ref, superCld, oid, insert);
            }
            else store(ref);
        }
    
        /**
         * Kuali Foundation modification -- 1/10/2008
         */
        ref = getProxyFactory().getRealObject(ref);
        /**
         * End of Kuali Foundation modification
         */
        link(obj, cld, rds, ref, insert);
    }
597752
def dereference_object(object_type, object_uuid, status):
    """"""
    from .models import PersistentIdentifier

    pids = PersistentIdentifier.query.filter_by(
        object_type=object_type, object_uuid=object_uuid
    )
    if status:
        pids = pids.filter_by(status=status)

    for found_pid in pids.all():
        click.echo(
            '{0.pid_type} {0.pid_value} {0.pid_provider}'.format(found_pid)
        )
221458
def reindex_scope(relation, import: true, resume: false, retain: false, async: false, refresh_interval: nil, scope: nil)
      if resume
        index_name = all_indices.sort.last
        raise Searchkick::Error, "No index to resume" unless index_name
        index = Searchkick::Index.new(index_name, @options)
      else
        clean_indices unless retain

        index_options = relation.searchkick_index_options
        index_options.deep_merge!(settings: {index: {refresh_interval: refresh_interval}}) if refresh_interval
        index = create_index(index_options: index_options)
      end

      import_options = {
        resume: resume,
        async: async,
        full: true,
        scope: scope
      }

      # check if alias exists
      alias_exists = alias_exists?
      if alias_exists
        # import before promotion
        index.import_scope(relation, **import_options) if import

        # get existing indices to remove
        unless async
          promote(index.name, update_refresh_interval: !refresh_interval.nil?)
          clean_indices unless retain
        end
      else
        delete if exists?
        promote(index.name, update_refresh_interval: !refresh_interval.nil?)

        # import after promotion
        index.import_scope(relation, **import_options) if import
      end

      if async
        if async.is_a?(Hash) && async[:wait]
          puts "Created index: #{index.name}"
          puts "Jobs queued. Waiting..."
          loop do
            sleep 3
            status = Searchkick.reindex_status(index.name)
            break if status[:completed]
            puts "Batches left: #{status[:batches_left]}"
          end
          # already promoted if alias didn't exist
          if alias_exists
            puts "Jobs complete. Promoting..."
            promote(index.name, update_refresh_interval: !refresh_interval.nil?)
          end
          clean_indices unless retain
          puts "SUCCESS!"
        end

        {index_name: index.name}
      else
        index.refresh
        true
      end
    rescue Elasticsearch::Transport::Transport::Errors::BadRequest => e
      if e.message.include?("No handler for type [text]")
        raise UnsupportedVersionError, "This version of Searchkick requires Elasticsearch 5 or greater"
      end

      raise e
    end
1243174
def varify_user_lock(repository_path, session_token):
    

    with open(cpjoin(repository_path, 'user_file'), 'r') as fd2:
        content = fd2.read()
        if len(content) == 0: return False
        try: res = json.loads(content)
        except ValueError: return False
        return res['session_token'] == session_token and int(time.time()) < int(res['expires'])
    return False
729869
protected void appendIdentityHashCode(StringBuilder buffer, Object object) {
        if (this.isUseIdentityHashCode() && object != null) {
            register(object);
            buffer.append('@');
            buffer.append(Integer.toHexString(System.identityHashCode(object)));
        }
    }
22562
function isUserLocked(username, path, callback) {
  var key = SyncLock.generateKey(username);
  redis.hget(key, path, function(err, value) {
    if(err) {
      log.error(err, 'Error getting redis lock key %s.', key);
      return callback(err);
    }

    callback(null, !!value);
  });
}
934934
function reindex($mode, $post_id, $message, $subject, $poster_id, $forum_id)
	{
		global $config, $phpbb_root_path, $phpEx;
		// Select the search method and do some additional checks to ensure it can actually be utilised
		$search_type =  basename($config['search_type']);

		if (!file_exists($phpbb_root_path . 'phpbb/search/' . $search_type . '.' . $phpEx))
		{
			trigger_error('NO_SUCH_SEARCH_MODULE', E_USER_ERROR);
		}

		require_once("{$phpbb_root_path}phpbb/search/$search_type.$phpEx");
		$search_type = "\\phpbb\\search\\" . $search_type;

		$error = false;
		$search = new $search_type($error);

		if ($error)
		{
			trigger_error($error);
		}

		$search->index($mode, $post_id, $message, $subject, $poster_id, $forum_id);
	}
645810
function reref(obj,options) {
    let master = obj;
    recurse(obj,{identityDetection:true},function(obj,key,state){
        if (state.identity) {
            let replacement = jptr(master,state.identityPath);
            // ensure it's still there and we've not reffed it away
            let newRef = state.identityPath;
            if (state.identityPath !== state.path) {
                if (options && options.prefix) newRef = newRef.replace('#/',options.prefix);
                if (replacement !== false) obj[key] = { $ref: newRef }
                else if (options && options.verbose) console.warn(state.identityPath,'gone away at',state.path);
            }
        }
    });
    return obj;
}