The user passed for async api referenced correct WebAPI user#22
The user passed for async api referenced correct WebAPI user#22vkublytskyi merged 12 commits into2.3.0-releasefrom
Conversation
…ass the Web API user id taken from the context object to MassScheduler
…ass the Web API user id taken from the context object to MassScheduler
|
|
|
@nuzil @anvasiliev can you please fix travis and sign CLA |
| $bulkDescription = __('Topic %1', $topicName); | ||
|
|
||
| if ($userId == null) { | ||
| $userId = $this->userContext->getUserId(); |
There was a problem hiding this comment.
User ID is not unique identifier and should be used in conjunction with user type.
There could be integration, admin and customer with the same ID. I believe bulk operation could at least be scheduled by the admin or integration.
There was a problem hiding this comment.
you are right the user ID is not unique.
@anvasiliev @nuzil How do you think if we save the user type?
There was a problem hiding this comment.
Hi @paliarush , @vrann
We though about 2 possible solutions, maybe we have to discuss it separately:
- We will add prefixes to users, like "admin_ID, customer_ID" .....
- We will add new column to this table with user_type.
What do you think?
There was a problem hiding this comment.
@munkhulzii @nuzil it would be a cleaner solution if we add another column, with the default value set to the admin. Otherwise it will be backward incompatible with the rest of the system
| $bulkDescription = __('Topic %1', $topicName); | ||
|
|
||
| if ($userId == null) { | ||
| $userId = $this->userContext->getUserId(); |
There was a problem hiding this comment.
@munkhulzii @nuzil it would be a cleaner solution if we add another column, with the default value set to the admin. Otherwise it will be backward incompatible with the rest of the system
|
|
||
| /** | ||
| * Set user type | ||
| * @param int $operationCount |
| $bulkUuid = 'bulk-001'; | ||
| $description = 'Bulk summary description...'; | ||
| $userId = 1; | ||
| $userType = 2; |
There was a problem hiding this comment.
User types are defined in \Magento\Authorization\Model\UserContextInterface as constants. Please use one of those constants to make code cleaner.
| BulkPublisherInterface $publisher, | ||
| MetadataPool $metadataPool, | ||
| ResourceConnection $resourceConnection, | ||
| UserContextInterface $userContext, |
There was a problem hiding this comment.
This constructor exists in Magento Commerce 2.2 so new parameters should be added corresponding to backward compatibility policies (at the end as optional)
| LoggerInterface $logger, | ||
| OperationRepository $operationRepository | ||
| OperationRepository $operationRepository, | ||
| UserContextInterface $userContext |
There was a problem hiding this comment.
This constructor exists in Magento Commerce 2.2 so new parameters should be added corresponding to backward compatibility policies (as optional)
- applied backward compatibility policy to modified constructors
vkublytskyi
left a comment
There was a problem hiding this comment.
Before merge following issues should be resolved:
- The class MassSchedule has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
- During upgrade foreign key
MAGENTO_BULK_USER_ID_ADMIN_USER_USER_IDis not dropped for Magento Commerce installation.
| @@ -1,47 +1,50 @@ | |||
| { | |||
| "magento_bulk": { | |||
There was a problem hiding this comment.
Please keep 4 spaces intendation for whitelists, changes are very hard to read.
| if ($elementType === self::INDEX_DIFF_TYPE) { | ||
| $generatedElements = $this->excludeAutoIndexes($generatedTable, $generatedElements); | ||
| // We should exclude from generated indexes only these auto indexes that correspond to | ||
| // declared constraint. If constraint is not declared we should clean up index created for it. |
There was a problem hiding this comment.
What is the purpose of this change?
It causes a case when autogenerated index will be implicitly removed from declaration so removing FK with preserving index for performance purposes won't work.
There was a problem hiding this comment.
If you need to remove index use declaration with 'disable="1"' attribute.
5d2de54 to
918f8ae
Compare
918f8ae to
f708896
Compare
https://app.zenhub.com/workspace/o/magento/bulk-api-ce/issues/14
Drop foreign key referencing admin_user table from bulk operations. Pass the Web API user id taken from the context object to MassScheduler