$userId = JFactory::getUser()->id; $assetName = 'com_content.article.1'; $actions = JAccess::getActions('com_content', 'component'); $userActions = JAccess::getActions('com_content', 'component', null, true); var_dump($actions); var_dump($userActions);
$user = JFactory::getUser(); $canEdit = $user->authorise('core.edit', 'com_content.article.1'); $canCreate = $user->authorise('core.create', 'com_content.article'); var_dump($canEdit); var_dump($canCreate);In this example, we are using the `authorise` method from the `JUser` class to check if the current user has permission to perform certain actions. We pass in the action name (`core.edit` and `core.create`) and the asset name (`com_content.article.1` and `com_content.article`) as parameters. We get a boolean value indicating whether the user has permission to perform the action. Package library: `joomla/access`