Skip to content

Commit

Permalink
Merge aa6ed71 into ae5e03e
Browse files Browse the repository at this point in the history
  • Loading branch information
Numkil committed Jul 17, 2020
2 parents ae5e03e + aa6ed71 commit 294eae1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 45 deletions.
6 changes: 6 additions & 0 deletions UPGRADE-5.7.md
Expand Up @@ -8,8 +8,14 @@ MediaBundle
This call now also requires a mandatory header called "x-upload-token". The content of this header
should be a csrf token generated by the Symfony csrf service using the name "bulk-upload-media".
This header is an added security layer to avoid unintended and malicious uploads.
* Validator\Constraints\Media and Validator\Constraints\HasGuessableExtension have had their error constant values changed from integer to string uuid's because integers have been deprecated by Symfony.

UserManagementBundle
------------

* Using the deleteAction method from the UsersController is deprecated since KunstmaanUserManagementBundle 5.6 and will be replaced by the method deleteFormAction in KunstmaanUserManagementBundle 6.0. Use the correct method instead. The new action is POST only and will have correct csrf protection.

AdminBundle
------------

* Validator\Constraints\PasswordRestrictions have had their error constant values changed from integer to string uuid's because integers have been deprecated by Symfony.
Expand Up @@ -9,25 +9,15 @@
*/
class PasswordRestrictions extends Constraint
{
const INVALID_MIN_DIGITS_ERROR = 1;
const INVALID_MIN_UPPERCASE_ERROR = 2;
const INVALID_MIN_SPECIAL_CHARACTERS_ERROR = 3;
const INVALID_MIN_LENGTH_ERROR = 4;
const INVALID_MAX_LENGTH_ERROR = 5;
public const INVALID_MIN_DIGITS_ERROR = 'af8b48ce-be95-4149-8ab8-f0770536c414';
public const INVALID_MIN_UPPERCASE_ERROR = '00939a50-4d1c-4cdc-8361-8a5c28ad9c54';
public const INVALID_MIN_SPECIAL_CHARACTERS_ERROR = '9e905eb6-0ece-4238-8ce9-1eb937280737';
public const INVALID_MIN_LENGTH_ERROR = '61c8ff3a-027b-449f-ad2d-2c8a3590d778';
public const INVALID_MAX_LENGTH_ERROR = '4203e839-0e15-4d9a-be26-68adbdc75614';

const MESSAGE_MIN_DIGITS = 'errors.password.mindigits';
const MESSAGE_MIN_UPPERCASE = 'errors.password.minuppercase';
const MESSAGE_MIN_SPECIAL_CHARACTERS = 'errors.password.minspecialcharacters';
const MESSAGE_MIN_LENGTH = 'errors.password.minlength';
const MESSAGE_MAX_LENGTH = 'errors.password.maxlength';

/**
* PasswordRestrictions constructor.
*
* @param null $options
*/
public function __construct($options = null)
{
parent::__construct($options);
}
public const MESSAGE_MIN_DIGITS = 'errors.password.mindigits';
public const MESSAGE_MIN_UPPERCASE = 'errors.password.minuppercase';
public const MESSAGE_MIN_SPECIAL_CHARACTERS = 'errors.password.minspecialcharacters';
public const MESSAGE_MIN_LENGTH = 'errors.password.minlength';
public const MESSAGE_MAX_LENGTH = 'errors.password.maxlength';
}
Expand Up @@ -9,16 +9,11 @@
*/
class HasGuessableExtension extends Constraint
{
const NOT_GUESSABLE_ERROR = 1;
public const NOT_GUESSABLE_ERROR = '496c3e10-17a0-4bb0-b3ad-c2bf99731703';

protected static $errorNames = array(
protected static $errorNames = [
self::NOT_GUESSABLE_ERROR => 'NOT_GUESSABLE_ERROR',
);
];

public $notGuessableErrorMessage = 'The uploaded file has no extension and could not be automatically guessed by the system.';

public function __construct($options = null)
{
parent::__construct($options);
}
}
29 changes: 12 additions & 17 deletions src/Kunstmaan/MediaBundle/Validator/Constraints/Media.php
Expand Up @@ -9,16 +9,16 @@
*/
class Media extends Constraint
{
const NOT_FOUND_ERROR = 1;
const NOT_READABLE_ERROR = 2;
const EMPTY_ERROR = 3;
const INVALID_MIME_TYPE_ERROR = 5;
const TOO_WIDE_ERROR = 11;
const TOO_NARROW_ERROR = 12;
const TOO_HIGH_ERROR = 13;
const TOO_LOW_ERROR = 14;

protected static $errorNames = array(
public const NOT_FOUND_ERROR = 'b707694b-ff60-4f3f-a1bb-22ecae5b6e0d';
public const NOT_READABLE_ERROR = 'b4fca756-28db-4c71-adfc-ef2a0c3c3d7c';
public const EMPTY_ERROR = 'bb60ad41-e149-407f-b52c-35023d123016';
public const INVALID_MIME_TYPE_ERROR = 'a6afff66-fe95-4f97-8753-de0b0ec9cdf3';
public const TOO_WIDE_ERROR = '30d779e0-0bb2-48d8-8571-9ce592ff04d3';
public const TOO_NARROW_ERROR = '2420b5ba-fd3e-4bf4-9f81-a91132ec42a3';
public const TOO_HIGH_ERROR = '9de7ece8-7837-4a6a-9602-6d0f4d2bd5fb';
public const TOO_LOW_ERROR = '8833baac-1c7f-402c-96b5-1cf7ac2eb955';

protected static $errorNames = [
self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR',
self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR',
self::EMPTY_ERROR => 'EMPTY_ERROR',
Expand All @@ -27,7 +27,7 @@ class Media extends Constraint
self::TOO_LOW_ERROR => 'TOO_LOW_ERROR',
self::TOO_WIDE_ERROR => 'TOO_WIDE_ERROR',
self::TOO_NARROW_ERROR => 'TOO_NARROW_ERROR',
);
];

public $minHeight;

Expand All @@ -39,7 +39,7 @@ class Media extends Constraint

public $binaryFormat;

public $mimeTypes = array();
public $mimeTypes = [];

public $notFoundMessage = 'The file could not be found.';

Expand Down Expand Up @@ -68,9 +68,4 @@ class Media extends Constraint
public $uploadExtensionErrorMessage = 'A PHP extension caused the upload to fail.';

public $uploadErrorMessage = 'The file could not be uploaded.';

public function __construct($options = null)
{
parent::__construct($options);
}
}

0 comments on commit 294eae1

Please sign in to comment.