Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 068da12

Browse files
committed
ENH: refs #236. Fix midas.community.create method
1 parent 0f741cc commit 068da12

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

core/models/base/CommunityModelBase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function incrementViewCount($communityDao)
9999
/** Create a community.
100100
* privacy: MIDAS_COMMUNITY_PUBLIC, MIDAS_COMMUNITY_PRIVATE
101101
* */
102-
function createCommunity($name, $description, $privacy, $user, $canJoin = null)
102+
function createCommunity($name, $description, $privacy, $user, $canJoin = null, $uuid = '')
103103
{
104104
$name = ucfirst($name);
105105
if($this->getByName($name) !== false)
@@ -130,6 +130,7 @@ function createCommunity($name, $description, $privacy, $user, $canJoin = null)
130130
$communityDao->setPrivacy($privacy);
131131
$communityDao->setCreation(date('c'));
132132
$communityDao->setCanJoin($canJoin);
133+
$communityDao->setUuid($uuid);
133134
$this->save($communityDao);
134135

135136
$modelLoad = new MIDAS_ModelLoader();

modules/api/controllers/components/ApiComponent.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,6 @@ function communityCreate($args)
410410
if(!empty($uuid))
411411
{
412412
$record = $uuidComponent->getByUid($uuid);
413-
if($record === false || !$communityModel->policyCheck($record, $userDao, MIDAS_POLICY_WRITE))
414-
{
415-
throw new Exception("This community doesn't exist or you don't have the permissions.", MIDAS_INVALID_POLICY);
416-
}
417413
}
418414
if($record != false && $record instanceof CommunityDao)
419415
{
@@ -450,7 +446,7 @@ function communityCreate($args)
450446
{
451447
$canJoin = $args['canjoin'];
452448
}
453-
$communityDao = $communityModel->createCommunity($name, $description, $privacy, $userDao, $canJoin);
449+
$communityDao = $communityModel->createCommunity($name, $description, $privacy, $userDao, $canJoin, $uuid);
454450

455451
if($communityDao === false)
456452
{

0 commit comments

Comments
 (0)