修改群信息

@param string $group_id
@param string $group_name
@param string $group_description
@param int    $max_user

@return mixed
@throws EasemobError
975141
public function groupEdit($group_id, $group_name = "", $group_description = "", $max_user = 0)
    {
        $url    = $this->url.'chatgroups/'.$group_id;
        $option = [
            "groupname"   => self::stringReplace($group_name),
            "description" => self::stringReplace($group_description),
            "maxusers"    => $max_user,
        ];
        $option = array_filter($option);
        if (empty($option)) {
            throw new EasemobError('提交修改的参数，不修改提交空！');
        }

        $access_token = $this->getToken();
        $header []    = 'Authorization: Bearer '.$access_token;

        return Http::postCurl($url, $option, $header, 'PUT');
    }
1328642
public function solosum($query_name, $group_name = false)
    {

        $col = ReporticoUtility::getQueryColumn($query_name, $this->columns);
        if (!$col) {
            ReporticoApp::handleError("The report includes an assignment involving a group or column ($query_name) that does not exist within the report");
            return 0;
        }

        $result = $col->column_value;

        if ($group_name) {
            if (!array_key_exists($group_name, $col->groupvals)) {
                $col->groupvals[$group_name] =
                array("average" => 0,
                    "sum" => "0",
                    "avgct" => 0,
                    "avgsum" => 0,
                    "min" => 0,
                    "max" => 0);
            }

            if ($this->changed($group_name)) {
                $col->groupvals[$group_name]["sum"] = $col->column_value;
            } else {
                $col->groupvals[$group_name]["sum"] += $col->column_value;
            }

            $result = $col->groupvals[$group_name]["sum"];
        } else {
            if ($col->reset_flag || !$col->sum) {
                $col->sum = $col->column_value;
            } else {
                $col->sum += $col->column_value;
            }

            $result = $col->sum;
        }

        return $result;
    }
1249649
public function groupAdd($group_name){
        $params=array(
            'group_name'=>$group_name
        );
        $rst = $this->_request->post($this->_url . 'group/add', $params);
        return $this->_client->rst($rst);
    }
1065388
public function addGroup($group_id)
    {
        $successful = true;
        
        if ($group_id == null) {
            return false;
        }
        
        // Remove all existing group(s) from user
        $this->groups()->detach();
        
        // Assign group(s) to user
        if (is_array($group_id)) {
            // If multiple roles
            if (count($group_id) > 0) {
                foreach ($group_id as $item) {
                    $new_group = Group::find($item);
                    if ($new_group == null) {
                        $successful = false;
                    } else {
                        $this->groups()->save($new_group);
                    }
                }
            }
        } else {
            $new_group = Group::find($group_id);
            if ($new_group == null) {
                $successful = false;
            } else {
                $this->groups()->save($new_group);
            }
        }
        
        return $successful;
    }
971653
public function groupDelete($group_id){
        $params=array(
            'group_id'=>$group_id
        );
        $rst = $this->_request->post($this->_url . 'group/delete', $params);
        return $this->_client->rst($rst);
    }
1043767
public function setGroupId(int $group_id) : CNabuDataObject
    {
        if ($group_id === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$group_id")
            );
        }
        $this->setValue('nb_cluster_user_group_id', $group_id);
        
        return $this;
    }
281909
public void createSecurityGroup(String groupName,
      String description) {

    AmazonEC2 amazonEC2 = getEc2Client();
    try {
      final CreateSecurityGroupRequest securityGroupRequest = new CreateSecurityGroupRequest()
          .withGroupName(groupName)
          .withDescription(description);
      amazonEC2.createSecurityGroup(securityGroupRequest);

      LOGGER.info("Created Security Group: " + groupName);
    } catch (AmazonServiceException ase) {
      // This might mean that security group is already created, hence ignore
      LOGGER.warn("Issue in creating security group", ase);
    }
  }
1282416
public function actionDataPermissionGrantGroup()
    {
        $groupId = (int) Yii::$app->request->getBodyParam('groupId');

        if (empty($groupId)) {
            throw new InvalidArgumentException("groupId can not be empty.");
        }

        return Yii::$app->db->createCommand()->delete('cms_nav_permission', ['group_id' => $groupId])->execute();
    }
1124931
public function can_create_discussions(stdClass $user, int $groupid = null) : bool {
        if (isguestuser($user) or !isloggedin()) {
            return false;
        }

        if ($this->forum->is_cutoff_date_reached()) {
            if (!has_capability('mod/forum:canoverridecutoff', $this->get_context())) {
                return false;
            }
        }

        switch ($this->forum->get_type()) {
            case 'news':
                $capability = 'mod/forum:addnews';
                break;
            case 'qanda':
                $capability = 'mod/forum:addquestion';
                break;
            default:
                $capability = 'mod/forum:startdiscussion';
        }

        if (!has_capability($capability, $this->forum->get_context(), $user)) {
            return false;
        }

        if ($this->forum->get_type() == 'eachuser') {
            if (forum_user_has_posted_discussion($this->forum->get_id(), $user->id, $groupid)) {
                return false;
            }
        }

        if ($this->forum->is_in_group_mode()) {
            return $groupid ? $this->can_access_group($user, $groupid) : $this->can_access_all_groups($user);
        } else {
            return true;
        }
    }
1266373
public function list_firewallgroups($group_id = null)
    {
        if (!$this->is_loggedin) {
            return false;
        }

        $response = $this->exec_curl('/api/s/' . $this->site . '/rest/firewallgroup/' . trim($group_id));

        return $this->process_response($response);
    }
616085
public function delete_group_option(string $id_option, string $id_group): ?int
  {
    if ( $id_option = $this->_get_id_option($id_option) ){
      return $this->db->delete($this->class_cfg['table'], [
        $this->fields['id_option'] => $id_option,
        $this->fields['id_group'] => $id_group
      ]);
    }
    return null;
  }
1049369
public static function collectByUser($user_id)
    {
        $user = AclUser::find($user_id);
        if ($user === null) {
            return collect([]);
        }

        return (new static)->where('group_id', $user->acl_group_id)->get();
    }
236813
function delete_group($group_id)
    {
        $group_cache = $this->_fetch_groups();
        $del_dn      = $group_cache[$group_id]['dn'];

        if (!$this->ldap->delete_entry($del_dn)) {
            $this->set_error(self::ERROR_SAVING, 'errorsaving');
            return false;
        }

        if ($this->cache) {
            unset($group_cache[$group_id]);
            $this->cache->set('groups', $group_cache);
        }

        return true;
    }
790947
public function update_group($id, $name = null, $course_name = null, $course_description = null, $course_link = null, $design_id = null){

		$data = array(
		    "group" => array(
		    	"name" => $name,
		    	"course_name" => $course_name,
				"course_description" => $course_description,
    			"course_link" => $course_link,
                "design_id" => $design_id
		    )
		);
		$data = $this->strip_empty_keys($data);

		$client = new \GuzzleHttp\Client();

		$response = $client->put($this->api_endpoint.'issuer/groups/'.$id, array(
		    'headers' =>  array('Authorization' => 'Token token="'.$this->getAPIKey().'"'),
		    'json' => $data
		));

		$result = json_decode($response->getBody());

		return $result;
	}
224848
public static function fetchByGroup( $groupID, $limit = false, $offset = false )
    {
        return self::fetchByConditions( array( "ezcobj_state_group.id=$groupID" ), $limit, $offset );
    }
1037070
public function getGroupCustom($group_name, $ref_name, $selection_name = 'group')
    {
        return $this->subVars->getCollectionSet($ref_name)->getGroup($group_name, $selection_name);
    }
970426
public function groupAddUsers($group_id, $users)
    {
        if (count($users) >= 60 || count($users) < 1) {
            throw new EasemobError('一次最多可以添加60位成员,最少为1个');
        }

        $url          = $this->url.'chatgroups/'.$group_id.'/users';
        $option       = [
            'usernames' => $users
        ];
        $access_token = $this->getToken();
        $header []    = 'Authorization: Bearer '.$access_token;

        return Http::postCurl($url, $option, $header, 'POST');
    }