Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Χάρης Παπαδόπουλος
e-epal
Commits
619f511c
Commit
619f511c
authored
Apr 12, 2017
by
Νίκος Κατσαούνος
Browse files
Several updates
parents
7d17f7d3
4983bc5d
Changes
52
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
619f511c
...
...
@@ -8,6 +8,7 @@ drupal/modules/*
!drupal/modules/epal/
!drupal/modules/epalreadydata/
!drupal/modules/oauthost/
!drupal/modules/casost/
!drupal/modules/epaldeploysystem/
# Logs
...
...
drupal/modules/casost/casost.info.yml
0 → 100644
View file @
619f511c
name
:
casost
type
:
module
description
:
Authentication Provider OST
core
:
8.x
package
:
casost
drupal/modules/casost/casost.links.action.yml
0 → 100644
View file @
619f511c
entity.casost_config.add_form
:
route_name
:
entity.casost_config.add_form
title
:
'
Add
CASOST
Config'
appears_on
:
-
entity.casost_config.collection
entity.casost_session.add_form
:
route_name
:
entity.casost_session.add_form
title
:
'
Add
CASOST
Session'
appears_on
:
-
entity.casost_session.collection
drupal/modules/casost/casost.links.menu.yml
0 → 100644
View file @
619f511c
# CASOST Config menu items definition
entity.casost_config.collection
:
title
:
'
CASOST
Config
list'
route_name
:
entity.casost_config.collection
description
:
'
List
CASOST
Config
entities'
parent
:
system.admin_structure
weight
:
100
casost_config.admin.structure.settings
:
title
:
CASOST Config settings
description
:
'
Configure
CASOST
Config
entities'
route_name
:
casost_config.settings
parent
:
system.admin_structure
# CASOST Session menu items definition
entity.casost_session.collection
:
title
:
'
CASOST
Session
list'
route_name
:
entity.casost_session.collection
description
:
'
List
CASOST
Session
entities'
parent
:
system.admin_structure
weight
:
100
casost_session.admin.structure.settings
:
title
:
CASOST Session settings
description
:
'
Configure
CASOST
Session
entities'
route_name
:
casost_session.settings
parent
:
system.admin_structure
drupal/modules/casost/casost.links.task.yml
0 → 100644
View file @
619f511c
# CASOST Config routing definition
casost_config.settings_tab
:
route_name
:
casost_config.settings
title
:
'
Settings'
base_route
:
casost_config.settings
entity.casost_config.canonical
:
route_name
:
entity.casost_config.canonical
base_route
:
entity.casost_config.canonical
title
:
'
View'
entity.casost_config.edit_form
:
route_name
:
entity.casost_config.edit_form
base_route
:
entity.casost_config.canonical
title
:
'
Edit'
entity.casost_config.delete_form
:
route_name
:
entity.casost_config.delete_form
base_route
:
entity.casost_config.canonical
title
:
Delete
weight
:
10
# CASOST Session routing definition
casost_session.settings_tab
:
route_name
:
casost_session.settings
title
:
'
Settings'
base_route
:
casost_session.settings
entity.casost_session.canonical
:
route_name
:
entity.casost_session.canonical
base_route
:
entity.casost_session.canonical
title
:
'
View'
entity.casost_session.edit_form
:
route_name
:
entity.casost_session.edit_form
base_route
:
entity.casost_session.canonical
title
:
'
Edit'
entity.casost_session.delete_form
:
route_name
:
entity.casost_session.delete_form
base_route
:
entity.casost_session.canonical
title
:
Delete
weight
:
10
drupal/modules/casost/casost.module
0 → 100644
View file @
619f511c
<?php
/**
* @file
* Contains casost.module.
*/
use
Drupal\Core\Routing\RouteMatchInterface
;
/**
* Implements hook_help().
*/
function
casost_help
(
$route_name
,
RouteMatchInterface
$route_match
)
{
switch
(
$route_name
)
{
// Main module help for the casost module.
case
'help.page.casost'
:
$output
=
''
;
$output
.
=
'<h3>'
.
t
(
'About'
)
.
'</h3>'
;
$output
.
=
'<p>'
.
t
(
'Authentication Provider OST'
)
.
'</p>'
;
return
$output
;
default
:
}
}
/**
* Implements hook_theme().
*/
function
casost_theme
()
{
return
[
'casost'
=>
[
'template'
=>
'casost'
,
'render element'
=>
'children'
,
],
];
}
drupal/modules/casost/casost.permissions.yml
0 → 100644
View file @
619f511c
add casost config entities
:
title
:
'
Create
new
CASOST
Config
entities'
administer casost config entities
:
title
:
'
Administer
CASOST
Config
entities'
description
:
'
Allow
to
access
the
administration
form
to
configure
CASOST
Config
entities.'
restrict access
:
true
delete casost config entities
:
title
:
'
Delete
CASOST
Config
entities'
edit casost config entities
:
title
:
'
Edit
CASOST
Config
entities'
access casost config overview
:
title
:
'
Access
the
CASOST
Config
overview
page'
view published casost config entities
:
title
:
'
View
published
CASOST
Config
entities'
view unpublished casost config entities
:
title
:
'
View
unpublished
CASOST
Config
entities'
add casost session entities
:
title
:
'
Create
new
CASOST
Session
entities'
administer casost session entities
:
title
:
'
Administer
CASOST
Session
entities'
description
:
'
Allow
to
access
the
administration
form
to
configure
CASOST
Session
entities.'
restrict access
:
true
delete casost session entities
:
title
:
'
Delete
CASOST
Session
entities'
edit casost session entities
:
title
:
'
Edit
CASOST
Session
entities'
access casost session overview
:
title
:
'
Access
the
CASOST
Session
overview
page'
view published casost session entities
:
title
:
'
View
published
CASOST
Session
entities'
view unpublished casost session entities
:
title
:
'
View
unpublished
CASOST
Session
entities'
drupal/modules/casost/casost.routing.yml
0 → 100644
View file @
619f511c
casost.log_in_go
:
path
:
/cas/login
defaults
:
_controller
:
'
\Drupal\casost\Controller\CASLogin::loginGo'
requirements
:
_access
:
'
TRUE'
casost.log_out_go
:
path
:
/cas/logout
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\casost\Controller\CASLogout::logoutGo'
requirements
:
_user_is_logged_in
:
'
TRUE'
drupal/modules/casost/casost.services.yml
0 → 100644
View file @
619f511c
services
:
logger.channel.cas
:
parent
:
'
logger.channel_base'
arguments
:
[
'
epal'
]
drupal/modules/casost/casost_config.page.inc
0 → 100644
View file @
619f511c
<?php
/**
* @file
* Contains casost_config.page.inc.
*
* Page callback for CASOST Config entities.
*/
use
Drupal\Core\Render\Element
;
/**
* Prepares variables for CASOST Config templates.
*
* Default template: casost_config.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function
template_preprocess_casost_config
(
array
&
$variables
)
{
// Fetch CASOSTConfig Entity Object.
$casost_config
=
$variables
[
'elements'
][
'#casost_config'
];
// Helpful $content variable for templates.
foreach
(
Element
::
children
(
$variables
[
'elements'
])
as
$key
)
{
$variables
[
'content'
][
$key
]
=
$variables
[
'elements'
][
$key
];
}
}
drupal/modules/casost/casost_session.page.inc
0 → 100644
View file @
619f511c
<?php
/**
* @file
* Contains casost_session.page.inc.
*
* Page callback for CASOST Session entities.
*/
use
Drupal\Core\Render\Element
;
/**
* Prepares variables for CASOST Session templates.
*
* Default template: casost_session.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function
template_preprocess_casost_session
(
array
&
$variables
)
{
// Fetch CASOSTSession Entity Object.
$casost_session
=
$variables
[
'elements'
][
'#casost_session'
];
// Helpful $content variable for templates.
foreach
(
Element
::
children
(
$variables
[
'elements'
])
as
$key
)
{
$variables
[
'content'
][
$key
]
=
$variables
[
'elements'
][
$key
];
}
}
drupal/modules/casost/composer.json
0 → 100644
View file @
619f511c
{
"name"
:
"drupal/casost"
,
"type"
:
"drupal-module"
,
"description"
:
"Authentication Provider OST"
,
"keywords"
:
[
"Drupal"
],
"license"
:
"GPL-2.0+"
,
"homepage"
:
"https://www.drupal.org/project/casost"
,
"minimum-stability"
:
"dev"
,
"support"
:
{
"issues"
:
"https://www.drupal.org/project/issues/casost"
,
"source"
:
"http://cgit.drupalcode.org/casost"
},
"require"
:
{
}
}
drupal/modules/casost/config/install/casost.settings.yml
0 → 100644
View file @
619f511c
drupal/modules/casost/config/install/casost.settingsold.yml
0 → 100644
View file @
619f511c
drupal/modules/casost/src/CASOSTConfigAccessControlHandler.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityAccessControlHandler
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\Core\Access\AccessResult
;
/**
* Access controller for the CASOST Config entity.
*
* @see \Drupal\casost\Entity\CASOSTConfig.
*/
class
CASOSTConfigAccessControlHandler
extends
EntityAccessControlHandler
{
/**
* {@inheritdoc}
*/
protected
function
checkAccess
(
EntityInterface
$entity
,
$operation
,
AccountInterface
$account
)
{
/** @var \Drupal\casost\Entity\CASOSTConfigInterface $entity */
switch
(
$operation
)
{
case
'view'
:
if
(
!
$entity
->
isPublished
())
{
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'view unpublished casost config entities'
);
}
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'view published casost config entities'
);
case
'update'
:
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'edit casost config entities'
);
case
'delete'
:
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'delete casost config entities'
);
}
// Unknown operation, no opinion.
return
AccessResult
::
neutral
();
}
/**
* {@inheritdoc}
*/
protected
function
checkCreateAccess
(
AccountInterface
$account
,
array
$context
,
$entity_bundle
=
NULL
)
{
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'add casost config entities'
);
}
}
drupal/modules/casost/src/CASOSTConfigHtmlRouteProvider.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityTypeInterface
;
use
Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
;
use
Symfony\Component\Routing\Route
;
/**
* Provides routes for CASOST Config entities.
*
* @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
* @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
*/
class
CASOSTConfigHtmlRouteProvider
extends
AdminHtmlRouteProvider
{
/**
* {@inheritdoc}
*/
public
function
getRoutes
(
EntityTypeInterface
$entity_type
)
{
$collection
=
parent
::
getRoutes
(
$entity_type
);
$entity_type_id
=
$entity_type
->
id
();
if
(
$collection_route
=
$this
->
getCollectionRoute
(
$entity_type
))
{
$collection
->
add
(
"entity.
{
$entity_type_id
}
.collection"
,
$collection_route
);
}
if
(
$settings_form_route
=
$this
->
getSettingsFormRoute
(
$entity_type
))
{
$collection
->
add
(
"
$entity_type_id
.settings"
,
$settings_form_route
);
}
return
$collection
;
}
/**
* Gets the collection route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected
function
getCollectionRoute
(
EntityTypeInterface
$entity_type
)
{
if
(
$entity_type
->
hasLinkTemplate
(
'collection'
)
&&
$entity_type
->
hasListBuilderClass
())
{
$entity_type_id
=
$entity_type
->
id
();
$route
=
new
Route
(
$entity_type
->
getLinkTemplate
(
'collection'
));
$route
->
setDefaults
([
'_entity_list'
=>
$entity_type_id
,
'_title'
=>
"
{
$entity_type
->
getLabel
()
}
list"
,
])
->
setRequirement
(
'_permission'
,
'access casost config overview'
)
->
setOption
(
'_admin_route'
,
TRUE
);
return
$route
;
}
}
/**
* Gets the settings form route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected
function
getSettingsFormRoute
(
EntityTypeInterface
$entity_type
)
{
if
(
!
$entity_type
->
getBundleEntityType
())
{
$route
=
new
Route
(
"/admin/structure/
{
$entity_type
->
id
()
}
/settings"
);
$route
->
setDefaults
([
'_form'
=>
'Drupal\casost\Form\CASOSTConfigSettingsForm'
,
'_title'
=>
"
{
$entity_type
->
getLabel
()
}
settings"
,
])
->
setRequirement
(
'_permission'
,
$entity_type
->
getAdminPermission
())
->
setOption
(
'_admin_route'
,
TRUE
);
return
$route
;
}
}
}
drupal/modules/casost/src/CASOSTConfigListBuilder.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Entity\EntityListBuilder
;
use
Drupal\Core\Routing\LinkGeneratorTrait
;
use
Drupal\Core\Url
;
/**
* Defines a class to build a listing of CASOST Config entities.
*
* @ingroup casost
*/
class
CASOSTConfigListBuilder
extends
EntityListBuilder
{
use
LinkGeneratorTrait
;
/**
* {@inheritdoc}
*/
public
function
buildHeader
()
{
$header
[
'id'
]
=
$this
->
t
(
'CASOST Config ID'
);
$header
[
'name'
]
=
$this
->
t
(
'Name'
);
return
$header
+
parent
::
buildHeader
();
}
/**
* {@inheritdoc}
*/
public
function
buildRow
(
EntityInterface
$entity
)
{
/* @var $entity \Drupal\casost\Entity\CASOSTConfig */
$row
[
'id'
]
=
$entity
->
id
();
$row
[
'name'
]
=
$this
->
l
(
$entity
->
label
(),
new
Url
(
'entity.casost_config.edit_form'
,
array
(
'casost_config'
=>
$entity
->
id
(),
)
)
);
return
$row
+
parent
::
buildRow
(
$entity
);
}
}
drupal/modules/casost/src/CASOSTSessionAccessControlHandler.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityAccessControlHandler
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\Core\Access\AccessResult
;
/**
* Access controller for the CASOST Session entity.
*
* @see \Drupal\casost\Entity\CASOSTSession.
*/
class
CASOSTSessionAccessControlHandler
extends
EntityAccessControlHandler
{
/**
* {@inheritdoc}
*/
protected
function
checkAccess
(
EntityInterface
$entity
,
$operation
,
AccountInterface
$account
)
{
/** @var \Drupal\casost\Entity\CASOSTSessionInterface $entity */
switch
(
$operation
)
{
case
'view'
:
if
(
!
$entity
->
isPublished
())
{
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'view unpublished casost session entities'
);
}
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'view published casost session entities'
);
case
'update'
:
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'edit casost session entities'
);
case
'delete'
:
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'delete casost session entities'
);
}
// Unknown operation, no opinion.
return
AccessResult
::
neutral
();
}
/**
* {@inheritdoc}
*/
protected
function
checkCreateAccess
(
AccountInterface
$account
,
array
$context
,
$entity_bundle
=
NULL
)
{
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'add casost session entities'
);
}
}
drupal/modules/casost/src/CASOSTSessionHtmlRouteProvider.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityTypeInterface
;
use
Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
;
use
Symfony\Component\Routing\Route
;
/**
* Provides routes for CASOST Session entities.
*
* @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
* @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
*/
class
CASOSTSessionHtmlRouteProvider
extends
AdminHtmlRouteProvider
{
/**
* {@inheritdoc}
*/
public
function
getRoutes
(
EntityTypeInterface
$entity_type
)
{
$collection
=
parent
::
getRoutes
(
$entity_type
);
$entity_type_id
=
$entity_type
->
id
();
if
(
$collection_route
=
$this
->
getCollectionRoute
(
$entity_type
))
{
$collection
->
add
(
"entity.
{
$entity_type_id
}
.collection"
,
$collection_route
);
}
if
(
$settings_form_route
=
$this
->
getSettingsFormRoute
(
$entity_type
))
{
$collection
->
add
(
"
$entity_type_id
.settings"
,
$settings_form_route
);
}
return
$collection
;
}
/**
* Gets the collection route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected
function
getCollectionRoute
(
EntityTypeInterface
$entity_type
)
{
if
(
$entity_type
->
hasLinkTemplate
(
'collection'
)
&&
$entity_type
->
hasListBuilderClass
())
{
$entity_type_id
=
$entity_type
->
id
();
$route
=
new
Route
(
$entity_type
->
getLinkTemplate
(
'collection'
));
$route
->
setDefaults
([
'_entity_list'
=>
$entity_type_id
,
'_title'
=>
"
{
$entity_type
->
getLabel
()
}
list"
,
])
->
setRequirement
(
'_permission'
,
'access casost session overview'
)
->
setOption
(
'_admin_route'
,
TRUE
);
return
$route
;
}
}
/**
* Gets the settings form route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected
function
getSettingsFormRoute
(
EntityTypeInterface
$entity_type
)
{
if
(
!
$entity_type
->
getBundleEntityType
())
{
$route
=
new
Route
(
"/admin/structure/
{
$entity_type
->
id
()
}
/settings"
);
$route
->
setDefaults
([
'_form'
=>
'Drupal\casost\Form\CASOSTSessionSettingsForm'
,
'_title'
=>
"
{
$entity_type
->
getLabel
()
}
settings"
,
])
->
setRequirement
(
'_permission'
,
$entity_type
->
getAdminPermission
())
->
setOption
(
'_admin_route'
,
TRUE
);
return
$route
;
}
}
}
drupal/modules/casost/src/CASOSTSessionListBuilder.php
0 → 100644