@@ 108-114 (lines=7) @@ | ||
105 | $user = $this->getUserContext()->getCurrentUser(); |
|
106 | $organization = $this->findOrganizationByName($name,false); |
|
107 | $repo = $this->getRepository('Organizations/Organization'); |
|
108 | if(!$organization instanceof Organization){ |
|
109 | ||
110 | $organization = new Organization(); |
|
111 | $organizationName = new OrganizationName($name); |
|
112 | $organization->setOrganizationName($organizationName); |
|
113 | $organization->setIsDraft(false); |
|
114 | } |
|
115 | /* @var OrganizationReference $orgReference */ |
|
116 | $orgReference = $user->getOrganization(); |
|
117 | $parent = $orgReference->getOrganization(); |
@@ 307-311 (lines=5) @@ | ||
304 | $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization'); |
|
305 | $result = $repoOrganization->findByName($orgName); |
|
306 | $organization = count($result) > 0 ? $result[0]:null; |
|
307 | if(!$organization instanceof Organization){ |
|
308 | $organization = new Organization(); |
|
309 | $organizationName = new OrganizationName($orgName); |
|
310 | $organization->setOrganizationName($organizationName); |
|
311 | } |
|
312 | $organization->setProfileSetting(Organization::PROFILE_ALWAYS_ENABLE); |
|
313 | $permissions = $organization->getPermissions(); |
|
314 | $permissions->grant($user,Permissions::PERMISSION_ALL); |