Skip to content

Instantly share code, notes, and snippets.

View glye's full-sized avatar

Gunnstein Lye glye

  • https://www.ibexa.co/
  • Norway
View GitHub Profile
@glye
glye / ezplatform_password_generator.php
Created June 18, 2020 13:28
Generate a new random password for an eZ Platform user. You have to run the SQL update statement yourself, with the correct user ID.
<?php
// Generate a new random password for an eZ Platform user. You have to run the SQL update statement yourself, with the correct user ID.
$password = bin2hex(random_bytes(8)); // 16-char hex password
print("New password: $password\n");
$hash = password_hash($password, PASSWORD_DEFAULT); // this is bcrypt, for now
print("New password hash: $hash\n");
print("Update SQL:\nUPDATE ezuser SET password_hash = '$hash', password_hash_type = 7 WHERE contentobject_id = INSERT YOUR ID HERE, ADMIN IS 14;\n");
@glye
glye / package.diff
Created January 16, 2018 13:07
eZ package trim
Index: ezpublish_legacy/kernel/classes/ezpackage.php
===================================================================
--- ezpublish_legacy/kernel/classes/ezpackage.php (revision 70715)
+++ ezpublish_legacy/kernel/classes/ezpackage.php (working copy)
@@ -1137,7 +1137,7 @@
// Search for the files we want to extract
foreach( $archive as $entry )
{
- if ( in_array( $entry->getPath(), $fileList ) )
+ if ( in_array( trim($entry->getPath(),DIRECTORY_SEPARATOR), $fileList ) )
EzSystems\PlatformUIBundle\Controller\ContentTypeController::viewContentTypeAction:251 EzSystems\PlatformUIBundle\Http\FormProcessingDoneResponse::__set_state(array(
'targetUrl' => NULL,
'headers' =>
Symfony\Component\HttpFoundation\ResponseHeaderBag::__set_state(array(
'computedCacheControl' =>
array (
'no-cache' => true,
),
'cookies' =>
array (
@glye
glye / $request->getContent()
Created September 28, 2015 13:21
eZ\Publish\Core\REST\Server\Controller\Role::assignRoleToUser() REST content
"RoleAssignInput":{
"Role":{
"xhr":{},
"body":"{
"Role": {
"_media-type": "application/vnd.ez.api.Role+json",
"_href": "/api/ezp/v2/user/roles/6",
"identifier": "Subscriber",
"Policies": {
"_media-type": "application/vnd.ez.api.PolicyList+json",
@glye
glye / RoleAssignInput.php.diff
Last active September 28, 2015 11:45
RoleAssignInput hack for EZP-24700: Role assignment CRUD
--- a/eZ/Publish/Core/REST/Server/Input/Parser/RoleAssignInput.php
+++ b/eZ/Publish/Core/REST/Server/Input/Parser/RoleAssignInput.php
@@ -48,6 +48,8 @@ class RoleAssignInput extends BaseParser
*/
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
{
+ $data = $data['Role']['document'];
+
if (!array_key_exists('Role', $data)) {
throw new Exceptions\Parser("Missing 'Role' element for RoleAssignInput.");