Record a user action on an item.

@param string $action
@param string $userId
@param string $itemId
@param array  $properties
@param null   $eventTime

@return string JSON response
773680
public function recordUserActionOnItem($action = 'view', $userId, $itemId, array $properties = [], $eventTime = null)
    {
        return $this->createCustomEvent($action, 'user', $userId, 'item', $itemId, $properties, $eventTime);
    }
672167
function ReportMemberGroupAction(Membergroup $memberGroup, Enums\Action $action)
    {
        $logItem = $this->CreateLogItem(Enums\ObjectType::MemberGroup(), $action);       
        if (!$action->Equals(Enums\Action::Delete()))
        {
            $logMemberGroup = new LogMembergroup();
            $logMemberGroup->SetLogItem($logItem);
            $logMemberGroup->SetMemberGroup($memberGroup);
            $logMemberGroup->Save();
        }
    }
796271
private void fireEvent(String action, ESigItem item) {
        if (eventManager != null) {
            eventManager.fireLocalEvent("ESIG." + action, item);
        }
    }
379172
public static function loggedCanDo($action, AbstractUser $object=null) {
		global $USER;
		return !empty($USER) && $USER->canDo($action, $object);
	}
575001
public function performAction($controller, $action) {
		// Replace namespace with directory separator
		$controllerFile = str_replace("\\", DIRECTORY_SEPARATOR, $controller);

		// Check if controller exists
		if ( false == is_file( $controllerLocation = APP . 'Controllers/' . $controllerFile . '.php' ) )
			throw new ControllerNotFoundException();

		// Include and init the controller
		$controllerClass = "\\Application\\Controllers\\{$controller}";
		$controllerObj = new $controllerClass($this);

		// Check if the action exists
		if ( 'Errors' != $controller && false == method_exists($controllerObj, $action.= "Action" ) )
			throw new ActionNotFoundException();
		// Check if the error display action exists
		elseif ( $controller == $this->defaultRoute['_controller'] && false == method_exists($controllerObj, $action = "display" . $action ) )
			throw new ErrorActionNotFoundException();

		// Run the action
		$data = $controllerObj->{$action}();

		// Data fetching
		if ( false === $controllerObj->__returnActionPerformed ):
			// Format returned data
			if ( false == is_array( $data ) )
				$data = (array) $data;

			// Start reflection for data loading
			$ref = new \ReflectionObject($controllerObj);
			$properties = $ref->getProperties(\ReflectionProperty::IS_PUBLIC);
			$controllerData = array();

			// Get public data
			foreach ( $properties as $property ):
				// Don't add internal variabels
				if ( '__returnActionPerformed' == $property->getName() )
					continue;

				// Add property to controller data
				$controllerData[$property->getName()] = $property->getValue($controllerObj);
			endforeach;

			// Merge data from controller and action
			$data = array_merge($controllerData, $data);
		endif;

		// Return the object
		return $data;
	}
466802
public function triggerActivate($action = null, $requesterUID = null)
    {
        if ($requesterUID === null) {
            $u = new User();
            $requesterUID = $u->getUserID();
        }

        $pkr = new ActivateUserWorkflowRequest();
        // default activate action of workflow is set after workflow request is created
        if ($action !== null) {
            $pkr->setRequestAction($action);
        }
        $pkr->setRequestedUserID($this->getUserID());
        $pkr->setRequesterUserID($requesterUID);
        $pkr->trigger();

        // Figure out whether the user was marked active during the workflow.
        // Usually happens if no workflows are attached (empty workflow).
        if ($this->connection->fetchColumn('SELECT uIsActive FROM Users WHERE uID = ? limit 1', [$this->getUserID()])) {
            $isActive = true;
        } else {
            $isActive = false;
        }
        $this->entity->setUserIsActive($isActive);

        return $isActive;
    }
537552
public function getForm($itemClass, $action)
	{
		$itemMetaData = $this->itemMetaDataFactory->getItemMetaData($itemClass);
		$form = $this->formFactory->create(
				new RequestType($itemMetaData), new Request(), array(
			'action' => $action,
			'method' => 'GET'
				)
		);
		return $form;
	}
1088544
public function doAction( $action, $params = array() )
    {
        if ( isset( $this->actions[ $action ] ) )
        {
            foreach( $this->actions[ $action ] as $callback )
            {
                call_user_func_array( $callback[ 'callback' ], $params );

                if ( $this->debug )
                {
                    echo PHP_EOL . '->ACTION: ' . $action . ' -> '
                            . $this->_serializeCallback( $callback[ 'callback' ] )
                            . ' + Priority: ' . $callback[ 'priority' ]
                            . PHP_EOL;
                }
            }
        }
    }
835003
public function performAction($action, $data = null) {
        $this->setTokenValue($this->getEntityIdName(), $this->getId());

        $payload = new \stdClass;
        $payload->data = new \stdClass;
        $payload->data->action = $action;
        $payload->data->data = is_null($data) ? new \stdClass : $data;

        $this->put(json_encode($payload));
    }
675730
public function revisionLog($action, $table, $id, array $old = [], array $new = [], $user = null)
    {
        $user = $this->parseUser($user);

        $connection = $this->getCurrentConnection();

        $format = $connection->getQueryGrammar()->getDateFormat();

        $connection->table($this->table)->insert([
            'action' => substr($action, 0, 255),
            'table_name' => substr($table, 0, 255),
            'row_id' => substr($id, 0, 255),
            'old' => json_encode($old),
            'new' => json_encode($new),
            'user' => substr($user, 0, 255),
            'ip' => substr($this->getFromServer('REMOTE_ADDR'), 0, 255) ?: null,
            'ip_forwarded' => substr($this->getFromServer('HTTP_X_FORWARDED_FOR'), 0, 255) ?: null,
            'created_at' => (new DateTime())->format($format),
        ]);

        $this->resetConnection();
    }
1311910
public function action($action, $content, array $parameters = [], array $attributes = [])
    {
        $action = [$action, $parameters];

        $this->makeSubItem('action', compact('action', 'content', 'attributes'));
    }
515770
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) {

        setValue(null);
        select(itemId);
        if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) {
            m_menu.setEntries(
                getMenuEntries(),
                Collections.singleton((((CmsPublishJobBase)getValue()).getPublishHistoryId()).getStringValue()));
            m_menu.openForTable(event, itemId, propertyId, CmsQueuedTable.this);
        } else if (event.getButton().equals(MouseButton.LEFT) && PROP_RESOURCES.equals(propertyId)) {
            showResourceDialog(((CmsPublishJobBase)getValue()).getPublishHistoryId().getStringValue());
        } else if (event.getButton().equals(MouseButton.LEFT) && PROP_PROJECT.equals(propertyId)) {
            if (!(getValue() instanceof CmsPublishJobEnqueued)) {
                showReportDialog((((CmsPublishJobBase)getValue()).getPublishHistoryId().getStringValue()));
            }
        }
    }
690442
public function execute($respTrackData = null, $userId = null)
    {
        $batch     = $this->getBatch();
        $tracker   = $this->loader->getTracker();
        $respTrack = $tracker->getRespondentTrack($respTrackData);

        $i = $batch->addToCounter('checkedRespondentTracks');

        if ($result = $respTrack->checkTrackTokens($userId)) {
            $a = $batch->addToCounter('tokenDateCauses');
            $b = $batch->addToCounter('tokenDateChanges', $result);
            $batch->setMessage('tokenDateChanges',
                    sprintf($this->_('%2$d token date changes in %1$d tracks.'), $a, $b)
                    );
        }

        $batch->setMessage('checkedRespondentTracks', sprintf($this->_('Checked %d tracks.'), $i));
    }
157187
public function onUserActionMenuRender(UserAdditionalActionEvent $event)
    {
        $user = $event->getUser();
        $url = $this->router->generate(
            'claro_tag_user_tag_form',
            array('user' => $user->getId())
        );

        $menu = $event->getMenu();
        $menu->addChild(
            $this->translator->trans('tag_action', array(), 'tag'),
            array('uri' => $url)
        )->setExtra('icon', 'fa fa-tags')
        ->setExtra('display', 'modal_form');

        return $menu;
    }
326357
function customHTTPAction( $http, $action, $parameters = array() )
    {
        $dataType = $this->dataType();
        if ( $dataType )
            $dataType->customObjectAttributeHTTPAction( $http, $action, $this, $parameters );
    }
801423
public function formAction($resourceId, User $user)
    {
        $noteManager = $this->getNoteActionManager();
        $notesQB = $noteManager->getNotesForPagination($resourceId, $user);
        $pager = $this->paginateQuery($notesQB, 1);

        return array('resourceId' => $resourceId, 'pager' => $pager);
    }
1245151
public static function canUserRunAction($actionUid, $user = null)
    {
        if (empty($user)) $user = Yii::$app->user;

        $parts = explode('/', $actionUid);
        if ($parts === false || count($parts) < 3) {
            throw new Exception("Illegal action uniqueId format: '{$actionUid}'");
        } else {
            $actionId = array_pop($parts);
            $controllerId = array_pop($parts);
            $moduleUid = implode ('/', $parts);

            $module = Yii::$app->getModule($moduleUid);
            if (empty($module)) {
                //throw new Exception("Can't get module '{$moduleUid}'");
                return false;
            } else {
                $controller = $module->createControllerByID($controllerId);
                if ($controller instanceof YiiBaseController) {
                    //static::$_modulesControllers[$moduleUid][$controllerId] = $controller::className();
                    $behaviors = $controller->behaviors();
                    if (empty($behaviors['access']['rules'])) {
                        $rules = [];
                    } else {
                        $rules = $behaviors['access']['rules'];
                    }
                    //static::$_accessRules[$moduleUid][$controllerId] = $rules;
                } else {
                    throw new Exception("Illegal controller '{$controllerId}' in module '{$moduleUid}'");
                }
            }

            if (empty($rules)) {
                $result = true; // no rules - action allow
            } else {
                $ac = Yii::createObject(['class' => AccessControl::className(), 'user' => $user, 'rules' => $rules]);
                $action = $controller->createAction($actionId);
                $request = Yii::$app->getRequest();
                $result = false; // if rule(s) exists - deny by default
                foreach ($ac->rules as $rule) {
                    if ($rule->allows($action, $user, $request)) {
                        $result = true; // found allow rule
                        break;
                    }
                }
            }

            return $result;
        }
    }