mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-04 15:44:07 +01:00
* [ADD] Allow to set account's owner when creating or copying the account. Related #1264
Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
@@ -820,10 +820,7 @@ final class AccountController extends ControllerBase implements CrudControllerIn
|
||||
$form = new AccountForm($this->dic);
|
||||
$form->validate(Acl::ACCOUNT_CREATE);
|
||||
|
||||
$itemData = $form->getItemData();
|
||||
$itemData->userId = $this->userData->getId();
|
||||
|
||||
$accountId = $this->accountService->create($itemData);
|
||||
$accountId = $this->accountService->create($form->getItemData());
|
||||
|
||||
$this->addCustomFieldsForItem(Acl::ACCOUNT, $accountId, $this->request);
|
||||
|
||||
|
||||
@@ -383,6 +383,7 @@ final class AccountHelper extends HelperBase
|
||||
$this->view->assign('otherUserGroupsView', $selectUserGroups->getItemsFromModelSelected($accountPermission->getUserGroupsView()));
|
||||
$this->view->assign('otherUserGroupsEdit', $selectUserGroups->getItemsFromModelSelected($accountPermission->getUserGroupsEdit()));
|
||||
|
||||
$this->view->assign('users', $selectUsers->getItemsFromModel());
|
||||
$this->view->assign('userGroups', $selectUserGroups->getItemsFromModel());
|
||||
$this->view->assign('tags', $selectTags->getItemsFromModel());
|
||||
|
||||
|
||||
@@ -157,7 +157,9 @@
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($_getvar('editAction')
|
||||
<?php if (($_getvar('editAction')
|
||||
|| $_getvar('createAction')
|
||||
|| $_getvar('copyAction'))
|
||||
&& ($_getvar('ctx_userIsAdminApp')
|
||||
|| $_getvar('ctx_userIsAdminAcc')
|
||||
|| $_getvar('ctx_userId') === $accountData->getUserId())): ?>
|
||||
|
||||
@@ -177,10 +177,23 @@ final class AccountService extends Service implements AccountServiceInterface
|
||||
*/
|
||||
public function create(AccountRequest $accountRequest)
|
||||
{
|
||||
$userData = $this->context->getUserData();
|
||||
|
||||
$accountRequest->changePermissions = AccountAclService::getShowPermission(
|
||||
$this->context->getUserData(),
|
||||
$userData,
|
||||
$this->context->getUserProfile());
|
||||
$accountRequest->userGroupId = $accountRequest->userGroupId ?: $this->context->getUserData()->getUserGroupId();
|
||||
|
||||
if (empty($accountRequest->userGroupId)
|
||||
|| !$accountRequest->changePermissions
|
||||
) {
|
||||
$accountRequest->userGroupId = $userData->getUserGroupId();
|
||||
}
|
||||
|
||||
if (empty($accountRequest->userId)
|
||||
|| !$accountRequest->changePermissions
|
||||
) {
|
||||
$accountRequest->userId = $userData->getId();
|
||||
}
|
||||
|
||||
if (empty($accountRequest->key)) {
|
||||
$pass = $this->getPasswordEncrypted($accountRequest->pass);
|
||||
|
||||
Reference in New Issue
Block a user