feat(users): govern profiles and access
Normalize fixed profile fields, profile actions, and the five-column capability matrix for comments, uploads, and downloads.
This commit is contained in:
@@ -451,8 +451,21 @@ trait UserControllerReportOperations {
|
||||
return $this->error('无效的举报类型');
|
||||
}
|
||||
|
||||
$reporter_id = get_current_user_id();
|
||||
if ($reporter_id <= 0) {
|
||||
return $this->error(__('请先登录', 'aksrt'), 401);
|
||||
}
|
||||
if ($target_type === 'user') {
|
||||
if ($target_id === $reporter_id) {
|
||||
return $this->error(__('不能举报自己', 'aksrt'), 400);
|
||||
}
|
||||
if (!function_exists('aksrt_user_can') || !aksrt_user_can('user_report', $reporter_id, $target_id)) {
|
||||
return $this->error(__('当前账号没有举报用户的权限', 'aksrt'), 403);
|
||||
}
|
||||
}
|
||||
|
||||
$report_id = \AKSRT\Messages\ReportCenter::get_instance()->submit(
|
||||
get_current_user_id(),
|
||||
$reporter_id,
|
||||
$target_type,
|
||||
$target_id,
|
||||
$reason,
|
||||
|
||||
Reference in New Issue
Block a user