Skip to content

Commit

Permalink
Merge pull request #1168 from proditis/rename-to-player_require_approval
Browse files Browse the repository at this point in the history
mass rename players_require_approval into player_require_approval
  • Loading branch information
proditis authored May 6, 2024
2 parents 0a37fe9 + e383439 commit 0d4a4ba
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions backend/modules/frontend/actions/player/MailAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public function run(int $id, $baseURL = "https://echoctf.red/activate/")
}
elseif ($player->status == 9)
{
if (\Yii::$app->sys->players_require_approval === true && $player->approval > 0 && $player->approval <= 2)
if (\Yii::$app->sys->player_require_approval === true && $player->approval > 0 && $player->approval <= 2)
$this->approvalMail($player);
elseif (\Yii::$app->sys->players_require_approval === true && $player->approval > 2 && $player->approval <= 4)
elseif (\Yii::$app->sys->player_require_approval === true && $player->approval > 2 && $player->approval <= 4)
$this->rejectionMail($player);
}
elseif ($player->status == 0)
Expand Down Expand Up @@ -78,7 +78,7 @@ private function approvalMail($player)
'emailVerify-text',
Yii::t('app', '{event_name} Account approved', ['event_name' => trim(Yii::$app->sys->event_name)])
);
if (Yii::$app->sys->players_require_approval === true && $player->approval == 1) {
if (Yii::$app->sys->player_require_approval === true && $player->approval == 1) {
$player->updateAttributes(['approval' => 2]);
\Yii::$app->getSession()->setFlash('success', Yii::t('app', 'Player activation mail send and approval status updated.'));
} else {
Expand Down
2 changes: 1 addition & 1 deletion backend/modules/frontend/controllers/PlayerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function actionDelete($id)
*/
public function actionSetDeleted($id)
{
if(\Yii::$app->sys->players_require_approval===true)
if(\Yii::$app->sys->player_require_approval===true)
$updateAttributes=['status' => 0, 'active' => 0,'approval'=>3];
else
$updateAttributes=['status' => 0, 'active' => 0];
Expand Down
8 changes: 4 additions & 4 deletions backend/modules/frontend/views/player/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
['class' => 'app\components\columns\ProfileColumn', 'idkey' => 'profile.id', 'attribute' => 'username', 'field' => 'username'],
[
'attribute'=>'affiliation',
'visible' => Yii::$app->sys->players_require_approval,
'visible' => Yii::$app->sys->player_require_approval,
'format'=>'html',
'value'=>function($model){
if($model->active==1) return Html::encode($model->affiliation);
Expand Down Expand Up @@ -119,7 +119,7 @@
[
'attribute'=>'approval',
'filter'=>$searchModel::APPROVAL,
'visible'=> Yii::$app->sys->players_require_approval===true,
'visible'=> Yii::$app->sys->player_require_approval===true,
'value' => function ($model) {
return $model::APPROVAL[$model->approval];
}
Expand Down Expand Up @@ -147,8 +147,8 @@
'mail'=>function($model){ if ($model->status==10 || $model->approval==0) return false; return true;},
'delete'=>function($model){ if (\Yii::$app->user->identity->isAdmin) return true; return false;},
'reset-activkey'=>function($model){ if ($model->active && trim($model->activkey)!=="") return true; return false;},
'approve'=>function($model){ if ($model->active==0 && Yii::$app->sys->players_require_approval===true && $model->approval<1) return true; return false;},
'reject'=>function($model){ if ($model->active==0 && Yii::$app->sys->players_require_approval===true && $model->approval<2) return true; return false;}
'approve'=>function($model){ if ($model->active==0 && Yii::$app->sys->player_require_approval===true && $model->approval<1) return true; return false;},
'reject'=>function($model){ if ($model->active==0 && Yii::$app->sys->player_require_approval===true && $model->approval<2) return true; return false;}
],
'template' => '{player-view-full} {clear-vpn} {view} {generate-ssl} {update} {delete} {ban} {mail} {reset-activkey} {approve} {reject} {set-deleted}',
'header' => Html::a(
Expand Down
4 changes: 2 additions & 2 deletions backend/modules/frontend/views/profile/_quick_actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
],
];

if (\Yii::$app->sys->players_require_approval === true)
if (\Yii::$app->sys->player_require_approval === true)
{
if ($model->owner->approval == 0 || $model->owner->approval==3)
{
Expand Down Expand Up @@ -88,7 +88,7 @@
'items' => array_merge($frontend_shortcuts, ['<div class="dropdown-divider"></div>',], $player_actions, ['<div class="dropdown-divider"></div>'], $profile_actions),
]
]);
if (\Yii::$app->sys->players_require_approval === true)
if (\Yii::$app->sys->player_require_approval === true)
{
echo "<b>Status: </b>",$model->owner::APPROVAL[$model->owner->approval],"\n";
}
Expand Down
10 changes: 6 additions & 4 deletions docs/Sysconfig-Keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
## Flags (0 false, 1 true)
* `event_active`: Enable/Disable current event
* `player_profile`: Enable/Disable player profiles
* `player_require_approval` If player activation requires moderator approval first
* `players_require_idenfication` Whether players need to provide proof of ID during registration
* `all_players_vip`: Allow all players to have VIP features enabled
* `dashboard_is_home`: Enable/Disable dashboard as default home page for players
* `teams`: Enable/Disable teams support
* (optional) `team_required`: Enable/Disable requirement for teams
* `approved_avatar`: Enable/Disable automatic avatar approval
* `leaderboard_show_zero`: Show zero points on leaderboard
* `leaderboard_visible_after_event_end`: Show leaderboard after event end
* `leaderboard_visible_before_event_start`: Show leaderboard before event start
* `all_players_vip`: Allow all players to have VIP features enabled
* `target_guest_view_deny`: Deny guests to target/view and target/versus
* `target_hide_inactive`: Hide inactive targets from the frontend listings. This includes upcoming powerups
* `network_view_guest`: Allow networks to be viewed by guests
Expand All @@ -19,7 +21,6 @@
* `maintenance`: Enable site-wide maintenance mode
* `maintenance_notification`: Send maintenance notification to everyone connected to the frontend interface. The popup can be dismissed but it always comes back. No other notifications are delivered.
* `require_activation` Whether it is required for users to activate their accounts
* `players_require_approval` If player activation requires moderator approval first
* `disable_registration` Whether online registrations are allowed
* `team_visible_instances` Whether or not player instances are visible to the rest of the team by default otherwise the per-instance field `team_allowed` takes priority
* `guest_visible_leaderboards` Whether or not the leaderboards will be visible to guest users (this still respects the event start/end restrictions)
Expand All @@ -38,6 +39,7 @@
* `writeup_rules` Your rules for writeup submissions
* `frontpage_scenario` The event scenario displayed at the `frontend/`, landing page for guests.
* `offense_scenario` A scenario displayed to the users once they have signed into the frontend.
* `defense_scenario` A scenario displayed to the users once they have signed into the frontend.
* `spins_per_day` Limit allowed restarts per day per player
* `online_timeout` Timeout in seconds that a user is no longer considered online on the platform
* `challenge_home` Full path to folder that the challenges will be uploaded to. (default: `@web/uploads/`)
Expand Down Expand Up @@ -94,9 +96,9 @@
* `stripe_automatic_tax_enabled` Enable Stripe automatic TAX

## Player Specific
* `academic_N` Name for academic value `N`
* `academic_N` Name for academic value `N` (starting at 0)
* `academic_Nshort` Short name for academic value `N`
* `academic_grouping` (1)Enable/(2)Disable support for academic grouping of activity stream
* `academic_grouping` (1)Enable/(0)Disable support for academic grouping of activity stream
example:
```sh
backend/yii sysconfig/set academic_grouping 1
Expand Down

0 comments on commit 0d4a4ba

Please sign in to comment.