-
Notifications
You must be signed in to change notification settings - Fork 453
/
connect.php
33 lines (29 loc) · 1.16 KB
/
connect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
namespace Concrete\Controller\Backend\Marketplace;
use Concrete\Controller\Backend\UserInterface\MarketplaceItem;
use Concrete\Core\Application\EditResponse;
use Concrete\Core\Legacy\TaskPermission;
class Connect extends MarketplaceItem
{
public function view()
{
// we also perform the "does the user need to buy it?" query here to save some requests
$r = new EditResponse();
$r->setAdditionalDataAttribute('isConnected', $this->marketplace->isConnected());
$r->setAdditionalDataAttribute('connectionError', $this->marketplace->getConnectionError());
if (is_object($this->item)) {
$r->setAdditionalDataAttribute('purchaseRequired', $this->item->purchaseRequired());
$r->setAdditionalDataAttribute('remoteURL', $this->item->getRemoteURL());
$r->setAdditionalDataAttribute('localURL', $this->item->getLocalURL());
if (!$this->item->purchaseRequired()) {
$this->item->enableFreeLicense();
}
}
$r->outputJSON();
}
protected function canAccess()
{
$tp = new TaskPermission();
return $tp->canInstallPackages();
}
}