public function actionEditRelation($id, $type = 0)
{
$group = Group::findOne($id);
if (!$group) {
throw new \Exception(yii::t('conf', 'relation not exists'));
}
$project = $this->findModel($group->project_id);
if (!in_array($type, [Group::TYPE_ADMIN, Group::TYPE_USER])) {
throw new \Exception(yii::t('conf', 'unknown relation type'));
}
$group->type = (int) $type;
if (!$group->save()) {
throw new \Exception(yii::t('w', 'update failed'));
}
$this->renderJson([]);
}