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
07de11f1
Commit
07de11f1
authored
Mar 13, 2017
by
Open Source Developer
Browse files
commit
parent
0e8caf80
Changes
24
Hide whitespace changes
Inline
Side-by-side
drupal/modules/epaldeploysystem/config/install/user.role.applicant.yml
0 → 100644
View file @
07de11f1
uuid
:
0bd9ffad-a953-4f38-a000-d9ab742f7708
langcode
:
el
status
:
true
dependencies
:
{
}
id
:
applicant
label
:
applicant
weight
:
3
is_admin
:
null
permissions
:
-
'
add
epal
student
class
entities'
-
'
add
epal
student
entities'
-
'
add
epal
student
course
field
entities'
-
'
add
epal
student
epal
chosen
entities'
-
'
add
epal
student
sector
field
entities'
-
'
add
epal
users
entities'
-
'
delete
epal
student
class
entities'
-
'
delete
epal
student
entities'
-
'
delete
epal
student
course
field
entities'
-
'
delete
epal
student
epal
chosen
entities'
-
'
delete
epal
student
sector
field
entities'
-
'
delete
epal
users
entities'
-
'
edit
epal
student
class
entities'
-
'
edit
epal
student
entities'
-
'
edit
epal
student
course
field
entities'
-
'
edit
epal
student
epal
chosen
entities'
-
'
edit
epal
student
sector
field
entities'
-
'
edit
epal
users
entities'
-
'
view
published
epal
student
class
entities'
-
'
view
published
epal
student
entities'
-
'
view
published
epal
student
course
field
entities'
-
'
view
published
epal
student
epal
chosen
entities'
-
'
view
published
epal
student
sector
field
entities'
-
'
view
published
epal
users
entities'
-
'
view
unpublished
epal
student
class
entities'
-
'
view
unpublished
epal
student
entities'
-
'
view
unpublished
epal
student
course
field
entities'
-
'
view
unpublished
epal
student
epal
chosen
entities'
-
'
view
unpublished
epal
student
sector
field
entities'
-
'
view
unpublished
epal
users
entities'
-
'
view
published
eepal
admin
area
entities'
-
'
view
published
eepal
prefecture
entities'
-
'
view
published
eepal
region
entities'
-
'
view
published
eepal
school
entities'
-
'
view
published
eepal
sectors
entities'
-
'
view
published
eepal
sectors
in
epal
entities'
-
'
view
published
eepal
specialties
in
epal
entities'
-
'
view
published
eepal
specialty
entities'
-
'
view
unpublished
eepal
admin
area
entities'
-
'
view
unpublished
eepal
prefecture
entities'
-
'
view
unpublished
eepal
region
entities'
-
'
view
unpublished
eepal
school
entities'
-
'
view
unpublished
eepal
sectors
entities'
-
'
view
unpublished
eepal
sectors
in
epal
entities'
-
'
view
unpublished
eepal
specialties
in
epal
entities'
-
'
view
unpublished
eepal
specialty
entities'
-
'
access
content'
drupal/modules/oauthost/config/install/oauthost.settingsold.yml
0 → 100644
View file @
07de11f1
drupal/modules/oauthost/src/Controller/OAuthLoginold.php
0 → 100644
View file @
07de11f1
<?php
namespace
Drupal\oauthost\Controller
;
use
Drupal\Core\Entity\Query\QueryFactory
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Drupal\Core\Controller\ControllerBase
;
use
OAuth
;
use
OAuthException
;
use
Drupal\user\Entity\User
;
use
Drupal\Core\Database\Connection
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Drupal\Core\Logger\LoggerChannelFactoryInterface
;
class
OAuthLogin
extends
ControllerBase
{
protected
$entity_query
;
protected
$entityTypeManager
;
protected
$logger
;
protected
$connection
;
protected
$consumer_key
=
'tc97t89'
;
protected
$consumer_secret
=
'xr7tgt9AbK3'
;
protected
$request_token_url
;
protected
$user_authorization_url
;
protected
$access_token_url
;
protected
$signature_method
;
protected
$api_url
;
protected
$callback_url
;
protected
$logout_url
;
public
function
__construct
(
EntityTypeManagerInterface
$entityTypeManager
,
QueryFactory
$entity_query
,
Connection
$connection
,
LoggerChannelFactoryInterface
$loggerChannel
)
{
$this
->
entityTypeManager
=
$entityTypeManager
;
$this
->
entity_query
=
$entity_query
;
$this
->
connection
=
$connection
;
$this
->
logger
=
$loggerChannel
->
get
(
'oauthost'
);
}
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'entity.manager'
),
$container
->
get
(
'entity.query'
),
$container
->
get
(
'database'
),
$container
->
get
(
'logger.factory'
)
);
}
public
function
loginGo
(
Request
$request
)
{
$ostauthConfigs
=
$this
->
entityTypeManager
->
getStorage
(
'oauthost_config'
)
->
loadByProperties
(
array
(
'name'
=>
'oauthost_taxisnet_config'
));
$ostauthConfig
=
reset
(
$ostauthConfigs
);
if
(
$ostauthConfig
)
{
$this
->
consumer_key
=
$ostauthConfig
->
consumer_key
->
value
;
$this
->
consumer_secret
=
$ostauthConfig
->
consumer_secret
->
value
;
$this
->
request_token_url
=
$ostauthConfig
->
request_token_url
->
value
;
$this
->
user_authorization_url
=
$ostauthConfig
->
user_authorization_url
->
value
;
$this
->
access_token_url
=
$ostauthConfig
->
access_token_url
->
value
;
$this
->
signature_method
=
$ostauthConfig
->
signature_method
->
value
;
$this
->
api_url
=
$ostauthConfig
->
api_url
->
value
;
$this
->
callback_url
=
$ostauthConfig
->
callback_url
->
value
;
$this
->
logout_url
=
$ostauthConfig
->
logout_url
->
value
;
}
else
{
$response
=
new
Response
();
$response
->
setContent
(
'forbidden'
);
$response
->
setStatusCode
(
Response
::
HTTP_FORBIDDEN
);
$response
->
headers
->
set
(
'Content-Type'
,
'application/json'
);
return
$response
;
}
$customUser
=
null
;
$customUsers
=
null
;
$userId
=
null
;
$user
=
null
;
try
{
$oauth
=
new
OAuth
(
$this
->
consumer_key
,
$this
->
consumer_secret
,
OAUTH_SIG_METHOD_PLAINTEXT
,
OAUTH_AUTH_TYPE_URI
);
$oauth
->
enableDebug
();
$uniqid
=
uniqid
(
'sid'
);
$requestToken
=
$oauth
->
getRequestToken
(
$this
->
request_token_url
,
$this
->
callback_url
.
'?sid_ost='
.
$uniqid
);
// store auth token
$oauthostSession
=
$this
->
entityTypeManager
()
->
getStorage
(
'oauthost_session'
)
->
create
(
array
(
// 'langcode' => $language_interface->getId(),
'langcode'
=>
'el'
,
'user_id'
=>
\
Drupal
::
currentUser
()
->
id
(),
'name'
=>
$uniqid
,
'request_token'
=>
$requestToken
[
'oauth_token'
],
'request_token_secret'
=>
$requestToken
[
'oauth_token_secret'
],
'status'
=>
1
));
$oauthostSession
->
save
();
header
(
'Location: '
.
$this
->
user_authorization_url
.
'?oauth_token='
.
$requestToken
[
'oauth_token'
]);
$this
->
logger
->
warning
(
'redirected to:'
.
$this
->
user_authorization_url
.
'?oauth_token='
.
$requestToken
[
'oauth_token'
]);
exit
;
}
catch
(
OAuthException
$e
)
{
$this
->
logger
->
warning
(
$e
->
getMessage
());
$response
=
new
Response
();
$response
->
setContent
(
'forbidden'
);
$response
->
setStatusCode
(
Response
::
HTTP_FORBIDDEN
);
$response
->
headers
->
set
(
'Content-Type'
,
'application/json'
);
return
$response
;
}
}
}
drupal/modules/oauthost/src/Entity/OAuthOSTConfigInterfaceold.php
0 → 100644
View file @
07de11f1
<?php
namespace
Drupal\oauthost\Entity
;
use
Drupal\Core\Entity\ContentEntityInterface
;
use
Drupal\Core\Entity\EntityChangedInterface
;
use
Drupal\user\EntityOwnerInterface
;
/**
* Provides an interface for defining OAuthOST Config entities.
*
* @ingroup oauthost
*/
interface
OAuthOSTConfigInterface
extends
ContentEntityInterface
,
EntityChangedInterface
,
EntityOwnerInterface
{
// Add get/set methods for your configuration properties here.
/**
* Gets the OAuthOST Config name.
*
* @return string
* Name of the OAuthOST Config.
*/
public
function
getName
();
/**
* Sets the OAuthOST Config name.
*
* @param string $name
* The OAuthOST Config name.
*
* @return \Drupal\oauthost\Entity\OAuthOSTConfigInterface
* The called OAuthOST Config entity.
*/
public
function
setName
(
$name
);
/**
* Gets the OAuthOST Config creation timestamp.
*
* @return int
* Creation timestamp of the OAuthOST Config.
*/
public
function
getCreatedTime
();
/**
* Sets the OAuthOST Config creation timestamp.
*
* @param int $timestamp
* The OAuthOST Config creation timestamp.
*
* @return \Drupal\oauthost\Entity\OAuthOSTConfigInterface
* The called OAuthOST Config entity.
*/
public
function
setCreatedTime
(
$timestamp
);
/**
* Returns the OAuthOST Config published status indicator.
*
* Unpublished OAuthOST Config are only visible to restricted users.
*
* @return bool
* TRUE if the OAuthOST Config is published.
*/
public
function
isPublished
();
/**
* Sets the published status of a OAuthOST Config.
*
* @param bool $published
* TRUE to set this OAuthOST Config to published, FALSE to set it to unpublished.
*
* @return \Drupal\oauthost\Entity\OAuthOSTConfigInterface
* The called OAuthOST Config entity.
*/
public
function
setPublished
(
$published
);
}
drupal/modules/oauthost/src/Entity/OAuthOSTConfigViewsDataold.php
0 → 100644
View file @
07de11f1
<?php
namespace
Drupal\oauthost\Entity
;
use
Drupal\views\EntityViewsData
;
/**
* Provides Views data for OAuthOST Config entities.
*/
class
OAuthOSTConfigViewsData
extends
EntityViewsData
{
/**
* {@inheritdoc}
*/
public
function
getViewsData
()
{
$data
=
parent
::
getViewsData
();
// Additional information for Views integration, such as table joins, can be
// put here.
return
$data
;
}
}
drupal/modules/oauthost/src/Entity/OAuthOSTConfigold.php
0 → 100644
View file @
07de11f1
<?php
namespace
Drupal\oauthost\Entity
;
use
Drupal\Core\Entity\EntityStorageInterface
;
use
Drupal\Core\Field\BaseFieldDefinition
;
use
Drupal\Core\Entity\ContentEntityBase
;
use
Drupal\Core\Entity\EntityChangedTrait
;
use
Drupal\Core\Entity\EntityTypeInterface
;
use
Drupal\user\UserInterface
;
/**
* Defines the OAuthOST Config entity.
*
* @ingroup oauthost
*
* @ContentEntityType(
* id = "oauthost_config",
* label = @Translation("OAuthOST Config"),
* handlers = {
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
* "list_builder" = "Drupal\oauthost\OAuthOSTConfigListBuilder",
* "views_data" = "Drupal\oauthost\Entity\OAuthOSTConfigViewsData",
*
* "form" = {
* "default" = "Drupal\oauthost\Form\OAuthOSTConfigForm",
* "add" = "Drupal\oauthost\Form\OAuthOSTConfigForm",
* "edit" = "Drupal\oauthost\Form\OAuthOSTConfigForm",
* "delete" = "Drupal\oauthost\Form\OAuthOSTConfigDeleteForm",
* },
* "access" = "Drupal\oauthost\OAuthOSTConfigAccessControlHandler",
* "route_provider" = {
* "html" = "Drupal\oauthost\OAuthOSTConfigHtmlRouteProvider",
* },
* },
* base_table = "oauthost_config",
* admin_permission = "administer oauthost config entities",
* entity_keys = {
* "id" = "id",
* "label" = "name",
* "uuid" = "uuid",
* "uid" = "user_id",
* "langcode" = "langcode",
* "status" = "status",
* },
* links = {
* "canonical" = "/admin/structure/oauthost_config/{oauthost_config}",
* "add-form" = "/admin/structure/oauthost_config/add",
* "edit-form" = "/admin/structure/oauthost_config/{oauthost_config}/edit",
* "delete-form" = "/admin/structure/oauthost_config/{oauthost_config}/delete",
* "collection" = "/admin/structure/oauthost_config",
* },
* field_ui_base_route = "oauthost_config.settings"
* )
*/
class
OAuthOSTConfig
extends
ContentEntityBase
implements
OAuthOSTConfigInterface
{
use
EntityChangedTrait
;
/**
* {@inheritdoc}
*/
public
static
function
preCreate
(
EntityStorageInterface
$storage_controller
,
array
&
$values
)
{
parent
::
preCreate
(
$storage_controller
,
$values
);
$values
+=
array
(
'user_id'
=>
\
Drupal
::
currentUser
()
->
id
(),
);
}
/**
* {@inheritdoc}
*/
public
function
getName
()
{
return
$this
->
get
(
'name'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setName
(
$name
)
{
$this
->
set
(
'name'
,
$name
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
getCreatedTime
()
{
return
$this
->
get
(
'created'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setCreatedTime
(
$timestamp
)
{
$this
->
set
(
'created'
,
$timestamp
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
getOwner
()
{
return
$this
->
get
(
'user_id'
)
->
entity
;
}
/**
* {@inheritdoc}
*/
public
function
getOwnerId
()
{
return
$this
->
get
(
'user_id'
)
->
target_id
;
}
/**
* {@inheritdoc}
*/
public
function
setOwnerId
(
$uid
)
{
$this
->
set
(
'user_id'
,
$uid
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
setOwner
(
UserInterface
$account
)
{
$this
->
set
(
'user_id'
,
$account
->
id
());
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
isPublished
()
{
return
(
bool
)
$this
->
getEntityKey
(
'status'
);
}
/**
* {@inheritdoc}
*/
public
function
setPublished
(
$published
)
{
$this
->
set
(
'status'
,
$published
?
true
:
false
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
static
function
baseFieldDefinitions
(
EntityTypeInterface
$entity_type
)
{
$fields
=
parent
::
baseFieldDefinitions
(
$entity_type
);
$fields
[
'user_id'
]
=
BaseFieldDefinition
::
create
(
'entity_reference'
)
->
setLabel
(
t
(
'Authored by'
))
->
setDescription
(
t
(
'The user ID of author of the OAuthOST Config entity.'
))
->
setRevisionable
(
true
)
->
setSetting
(
'target_type'
,
'user'
)
->
setSetting
(
'handler'
,
'default'
)
->
setTranslatable
(
true
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'hidden'
,
'type'
=>
'author'
,
'weight'
=>
0
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'entity_reference_autocomplete'
,
'weight'
=>
5
,
'settings'
=>
array
(
'match_operator'
=>
'CONTAINS'
,
'size'
=>
'60'
,
'autocomplete_type'
=>
'tags'
,
'placeholder'
=>
''
,
),
))
->
setDisplayConfigurable
(
'form'
,
true
)
->
setDisplayConfigurable
(
'view'
,
true
);
$fields
[
'name'
]
=
BaseFieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Name'
))
->
setDescription
(
t
(
'The name of the OAuthOST Config entity.'
))
->
setSettings
(
array
(
'max_length'
=>
50
,
'text_processing'
=>
0
,
))
->
setDefaultValue
(
'oauthost_taxisnet_config'
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'above'
,
'type'
=>
'string'
,
'weight'
=>
-
4
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'string_textfield'
,
'weight'
=>
-
4
,
))
->
setDisplayConfigurable
(
'form'
,
true
)
->
setDisplayConfigurable
(
'view'
,
true
);
$fields
[
'consumer_key'
]
=
BaseFieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Consumer Key'
))
->
setDescription
(
t
(
'The Consumer Key'
))
->
setSettings
(
array
(
'max_length'
=>
200
,
'text_processing'
=>
0
,
))
->
setDefaultValue
(
''
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'above'
,
'type'
=>
'string'
,
'weight'
=>
-
4
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'string_textfield'
,
'weight'
=>
-
4
,
))
->
setDisplayConfigurable
(
'form'
,
true
)
->
setDisplayConfigurable
(
'view'
,
true
);
$fields
[
'consumer_secret'
]
=
BaseFieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Consumer Secret'
))
->
setDescription
(
t
(
'The Consumer Secret'
))
->
setSettings
(
array
(
'max_length'
=>
200
,
'text_processing'
=>
0
,
))
->
setDefaultValue
(
''
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'above'
,
'type'
=>
'string'
,
'weight'
=>
-
4
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'string_textfield'
,
'weight'
=>
-
4
,
))
->
setDisplayConfigurable
(
'form'
,
true
)
->
setDisplayConfigurable
(
'view'
,
true
);
$fields
[
'request_token_url'
]
=
BaseFieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Request Token Url'
))
->
setDescription
(
t
(
'The Request Token Url'
))
->
setSettings
(
array
(
'max_length'
=>
500
,
'text_processing'
=>
0
,
))
->
setDefaultValue
(
'https://www1.gsis.gr/gsisapps/gsisdemo/oauth/request_token'
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'above'
,
'type'
=>
'string'
,
'weight'
=>
-
4
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'string_textfield'
,
'weight'
=>
-
4
,
))
->
setDisplayConfigurable
(
'form'
,
true
)
->
setDisplayConfigurable
(
'view'
,
true
);
$fields
[
'user_authorization_url'
]
=
BaseFieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'User Authorization Url'
))
->
setDescription
(
t
(
'The User Authorization Url'
))
->
setSettings
(
array
(
'max_length'
=>
500
,
'text_processing'
=>
0
,
))
->
setDefaultValue
(
'https://www1.gsis.gr/gsisapps/gsisdemo/oauth/confirm_access'
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'above'
,
'type'
=>
'string'
,
'weight'
=>
-
4
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'string_textfield'
,
'weight'
=>
-
4
,
))
->
setDisplayConfigurable
(
'form'
,
true
)
->
setDisplayConfigurable
(
'view'
,
true
);
$fields
[
'access_token_url'
]
=
BaseFieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Access Token Url'
))
->
setDescription
(
t
(
'The Access Token Url'
))
->
setSettings
(
array
(
'max_length'
=>
500
,
'text_processing'
=>
0
,
))
->
setDefaultValue
(
'https://www1.gsis.gr/gsisapps/gsisdemo/oauth/access_token'
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'above'
,
'type'
=>
'string'
,
'weight'
=>
-
4
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'string_textfield'
,
'weight'
=>
-
4
,
))
->
setDisplayConfigurable
(
'form'
,
true
)
->
setDisplayConfigurable
(
'view'
,
true
);