Skip to content

Commit

Permalink
Merge pull request #1293 from Koen1999/dreamspark
Browse files Browse the repository at this point in the history
Removed all dreamspark artefacts and replaced dreamspark button with supremum button
  • Loading branch information
tomudding authored Dec 3, 2021
2 parents f3fd3b3 + 11d2f31 commit 66dd911
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 107 deletions.
15 changes: 0 additions & 15 deletions config/autoload/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,6 @@
'public_summary_dir' => 'data/education_temp_summaries',
],

/*
* Dreamspark configuration.
*/
'dreamspark' => [
'url' => 'https://e5.onthehub.com/WebStore/Security/AuthenticateUser.aspx?account=%ACCOUNT%&username=%EMAIL%&key=%KEY%&academic_statuses=%GROUPS%',
// configured locally
'account' => '',
'key' => '',
],

/*
* CA Path for SSL certificates, override this locally if necessary.
*/
'sslcapath' => '/etc/ssl/certs',

/*
* Path for JWT keypairs
*/
Expand Down
9 changes: 0 additions & 9 deletions module/Decision/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,6 @@
],
],
],
'dreamspark' => [
'type' => Literal::class,
'options' => [
'route' => '/dreamspark',
'defaults' => [
'action' => 'dreamspark',
],
],
],
'view' => [
'type' => Segment::class,
'options' => [
Expand Down
10 changes: 0 additions & 10 deletions module/Decision/src/Controller/MemberController.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,6 @@ public function birthdaysAction()
);
}

/**
* Action to go to dreamspark.
*/
public function dreamsparkAction()
{
$url = $this->memberService->getDreamsparkUrl();

return $this->redirect()->toUrl($url);
}

/**
* Action to download regulations.
*/
Expand Down
3 changes: 0 additions & 3 deletions module/Decision/src/Service/AclService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ protected function createAcl()
// add resources for this module
$this->acl->addResource('organ');
$this->acl->addResource('member');
$this->acl->addResource('dreamspark');
$this->acl->addResource('decision');
$this->acl->addResource('meeting');
$this->acl->addResource('authorization');
Expand All @@ -36,8 +35,6 @@ protected function createAcl()

$this->acl->allow('user', 'meeting', ['view', 'view_notes', 'view_documents']);

$this->acl->allow('user', 'dreamspark', ['login', 'students']);

$this->acl->allow('user', 'authorization', ['create', 'view_own']);

// users are allowed to use the filebrowser
Expand Down
48 changes: 0 additions & 48 deletions module/Decision/src/Service/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,54 +71,6 @@ public function findMemberByLidNr($lidnr)
return $this->memberMapper->findByLidnr($lidnr);
}

/**
* Get the dreamspark URL for the current user.
*/
public function getDreamsparkUrl()
{
if (!$this->aclService->isAllowed('login', 'dreamspark')) {
throw new NotAllowedException(
$this->translator->translate('You are not allowed login into Microsoft Imagine.')
);
}

$user = $this->aclService->getIdentityOrThrowException();

$sslcapath = $this->config['sslcapath'];
$dreamsparkConfig = $this->config['dreamspark'];

// determine groups for dreamspark
$groups = [];
if ($this->aclService->isAllowed('students', 'dreamspark')) {
$groups[] = 'students';
}
if ($this->aclService->isAllowed('faculty', 'dreamspark')) {
$groups[] = 'faculty';
}
if ($this->aclService->isAllowed('staff', 'dreamspark')) {
$groups[] = 'staff';
}

$url = $dreamsparkConfig['url'];
$url = str_replace('%ACCOUNT%', $dreamsparkConfig['account'], $url);
$url = str_replace('%KEY%', $dreamsparkConfig['key'], $url);
$url = str_replace('%EMAIL%', $user->getEmail(), $url);
$url = str_replace('%GROUPS%', implode(',', $groups), $url);

$client = new HttpClient($url, [
'sslcapath' => $sslcapath,
]);
$response = $client->send();

if (200 != $response->getStatusCode()) {
throw new NotAllowedException(
$this->translator->translate('Login to Microsoft Imagine failed. If this persists, contact the WebCommittee.')
);
}

return $response->getBody();
}

/**
* Get the members of which their birthday falls in the next $days days.
*
Expand Down
6 changes: 3 additions & 3 deletions module/Decision/view/decision/member/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ $meetings = $this->meetings;
<div class="big-icon fas fa-search"></div>
<div class="panel-heading"><?= $this->translate('Find a member') ?></div>
</a>
<a href="<?= $this->url('member/dreamspark') ?>" class="panel panel-image align-middle">
<div class="big-icon fas fa-compact-disc"></div>
<div class="panel-heading"><?= $this->translate('Microsoft Imagine') ?></div>
<a href="https://supremum.gewis.nl/" class="panel panel-image align-middle">
<div class="big-icon fas fa-book"></div>
<div class="panel-heading">Supremum</div>
</a>
<a href="<?= $this->url('home/page', ['category' => 'links']) ?>"
class="panel panel-image align-middle">
Expand Down
19 changes: 0 additions & 19 deletions module/Education/view/education/education/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -142,25 +142,6 @@ $this->headTitle($this->translate('Education'));
</div>
</div>
</div>

<?php if ($this->acl('decision_service_acl')->isAllowed('dreamspark', 'login')): ?>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<span class="h4"><?= $this->translate('Microsoft Imagine') ?></span>
</div>
<div class="panel-body">
<p><?= $this->translate('Through Microsoft Imagine you have access to a vast variety of Microsoft products at no cost. The only requirement is that you are a member of GEWIS.') ?></p>
</div>
<div class="panel-footer panel-footer--links">
<a href="<?= $this->url('member/dreamspark') ?>"
title="<?= $this->translate('Visit the Microsoft Imagine portal') ?>"
class="panel-footer__link--primary"
target="_blank"><?= $this->translate('Visit portal') ?></a>
</div>
</div>
</div>
<?php endif ?>
</div>

<div class="row row-spacing-top">
Expand Down

0 comments on commit 66dd911

Please sign in to comment.