mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
src: style sweep
This commit is contained in:
parent
6603fb72ed
commit
72018838d0
@ -69,7 +69,7 @@ class GroupController extends ApiMutableModelControllerBase
|
||||
$result = $this->addBase('group', 'group');
|
||||
if ($result['result'] != 'failed') {
|
||||
$data = $this->request->getPost(static::$internalModelName);
|
||||
(new Backend())->configdRun('auth sync group '. $data['name']);
|
||||
(new Backend())->configdRun('auth sync group ' . $data['name']);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -79,7 +79,7 @@ class GroupController extends ApiMutableModelControllerBase
|
||||
$result = $this->setBase('group', 'group', $uuid);
|
||||
if ($result['result'] != 'failed') {
|
||||
$data = $this->request->getPost(static::$internalModelName);
|
||||
(new Backend())->configdRun('auth sync group '. $data['name']);
|
||||
(new Backend())->configdRun('auth sync group ' . $data['name']);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -99,7 +99,7 @@ class GroupController extends ApiMutableModelControllerBase
|
||||
}
|
||||
$result = $this->delBase('group', $uuid);
|
||||
if ($groupname != null) {
|
||||
(new Backend())->configdRun('auth sync group '. $groupname);
|
||||
(new Backend())->configdRun('auth sync group ' . $groupname);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -34,7 +34,6 @@ use OPNsense\Auth\Group;
|
||||
use OPNsense\Core\ACL;
|
||||
use OPNsense\Core\Config;
|
||||
|
||||
|
||||
/**
|
||||
* Class PrivController
|
||||
* @package OPNsense\Auth\Api
|
||||
@ -117,9 +116,9 @@ class PrivController extends ApiMutableModelControllerBase
|
||||
$groupmdl = new Group();
|
||||
foreach ([$usermdl->user, $groupmdl->group] as $topic) {
|
||||
if ($topic == $usermdl->user) {
|
||||
$uuids = explode(',', $mdl->users->getCurrentValue());
|
||||
$uuids = explode(',', $mdl->users->getCurrentValue());
|
||||
} else {
|
||||
$uuids = explode(',', $mdl->groups->getCurrentValue());
|
||||
$uuids = explode(',', $mdl->groups->getCurrentValue());
|
||||
}
|
||||
foreach ($topic->iterateItems() as $uuid => $item) {
|
||||
$privlist = array_filter(explode(',', $item->priv->getCurrentValue()));
|
||||
@ -139,5 +138,4 @@ class PrivController extends ApiMutableModelControllerBase
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -106,12 +106,12 @@ class UserController extends ApiMutableModelControllerBase
|
||||
public function searchAction()
|
||||
{
|
||||
$result = $this->searchBase('user');
|
||||
if (!empty($result['rows'])){
|
||||
if (!empty($result['rows'])) {
|
||||
/* XXX: this is a bit of a gimmick, for performance reasons we might decide to drop this at some point */
|
||||
foreach ($result['rows'] as &$row) {
|
||||
$row['is_admin'] = in_array('page-all', $this->getModel()->getUserPrivs($row['name'])) ? '1' : '0';
|
||||
/* shells usually start with a /, prevent default text and translations triggering the warning */
|
||||
$row['shell_warning'] = strpos($row['shell'], '/') === 0 && empty($row['is_admin']) ? '1' :'0';
|
||||
$row['shell_warning'] = strpos($row['shell'], '/') === 0 && empty($row['is_admin']) ? '1' : '0';
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
@ -155,7 +155,7 @@ class UserController extends ApiMutableModelControllerBase
|
||||
if ($result['result'] != 'failed') {
|
||||
$data = $this->request->getPost(static::$internalModelName);
|
||||
if (!empty($data['name'])) {
|
||||
(new Backend())->configdRun('auth sync user '. $data['name']);
|
||||
(new Backend())->configdRun('auth sync user ' . $data['name']);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
@ -167,7 +167,7 @@ class UserController extends ApiMutableModelControllerBase
|
||||
if ($result['result'] != 'failed') {
|
||||
$data = $this->request->getPost(static::$internalModelName);
|
||||
if (!empty($data['name'])) {
|
||||
(new Backend())->configdRun('auth sync user '. $data['name']);
|
||||
(new Backend())->configdRun('auth sync user ' . $data['name']);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
@ -196,7 +196,7 @@ class UserController extends ApiMutableModelControllerBase
|
||||
}
|
||||
$result = $this->delBase('user', $uuid);
|
||||
if ($username != null) {
|
||||
(new Backend())->configdRun('auth sync user '. $username);
|
||||
(new Backend())->configdRun('auth sync user ' . $username);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -240,5 +240,4 @@ class UserController extends ApiMutableModelControllerBase
|
||||
}
|
||||
return ["result" => "failed"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@ namespace OPNsense\Auth;
|
||||
|
||||
class GroupController extends \OPNsense\Base\IndexController
|
||||
{
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->formDialogEditGroup = $this->getForm("dialogGroup");
|
||||
|
||||
@ -30,7 +30,6 @@ namespace OPNsense\Auth;
|
||||
|
||||
class PrivController extends \OPNsense\Base\IndexController
|
||||
{
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->formDialogEditPriv = $this->getForm("dialogPriv");
|
||||
|
||||
@ -187,7 +187,7 @@ abstract class Base
|
||||
// update when changed
|
||||
if ($user == null && $createuser) {
|
||||
// user creation when enabled
|
||||
$add_user = json_decode((new Backend())->configdpRun("auth add user",[$username]), true);
|
||||
$add_user = json_decode((new Backend())->configdpRun("auth add user", [$username]), true);
|
||||
if (!empty($add_user) && $add_user['status'] == 'ok') {
|
||||
Config::getInstance()->forceReload();
|
||||
$user = $this->getUser($username);
|
||||
@ -228,7 +228,7 @@ abstract class Base
|
||||
}
|
||||
}
|
||||
Config::getInstance()->save();
|
||||
(new Backend())->configdpRun("auth user changed",[$username]);
|
||||
(new Backend())->configdpRun("auth user changed", [$username]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -135,5 +135,3 @@ class ApiKeyField extends BaseField
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -78,5 +78,3 @@ class ExpiresField extends TextField
|
||||
return $validators;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ class GidField extends IntegerField
|
||||
foreach ($this->getParentModel()->group->iterateItems() as $group) {
|
||||
$gids[] = (int)$group->gid->getCurrentValue();
|
||||
}
|
||||
for ($i=2000; true; $i++) {
|
||||
for ($i = 2000; true; $i++) {
|
||||
if (!in_array($i, $gids)) {
|
||||
parent::setValue((string)$i);
|
||||
break;
|
||||
@ -107,5 +107,3 @@ class GidField extends IntegerField
|
||||
return $validators;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -44,7 +44,6 @@ class MemberField extends BaseListField
|
||||
foreach ((new User())->user->iterateItems() as $node) {
|
||||
self::$uid_list[(string)$node->uid] = (string)$node->name;
|
||||
}
|
||||
|
||||
}
|
||||
$this->internalOptionList = self::$uid_list;
|
||||
}
|
||||
|
||||
@ -53,5 +53,3 @@ class StoreB64Field extends TextField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ class UidField extends IntegerField
|
||||
foreach ($this->getParentModel()->user->iterateItems() as $user) {
|
||||
$uids[] = (int)$user->uid->getCurrentValue();
|
||||
}
|
||||
for ($i=2000; true; $i++) {
|
||||
for ($i = 2000; true; $i++) {
|
||||
if (!in_array($i, $uids)) {
|
||||
parent::setValue((string)$i);
|
||||
break;
|
||||
@ -107,5 +107,3 @@ class UidField extends IntegerField
|
||||
return $validators;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ if (isset($opts['h']) || empty($opts['u'])) {
|
||||
if ($update_user) {
|
||||
local_user_set($update_user, false, $localusers[$username] ?? []);
|
||||
/* signal backend that the user has changed. (update groups) */
|
||||
mwexecf('/usr/local/sbin/pluginctl -c user_changed '. $username);
|
||||
mwexecf('/usr/local/sbin/pluginctl -c user_changed ' . $username);
|
||||
echo json_encode(["status" => "updated"]);
|
||||
} else {
|
||||
echo json_encode(["status" => "not_found"]);
|
||||
|
||||
@ -30,4 +30,4 @@
|
||||
require_once 'config.inc';
|
||||
require_once 'system.inc';
|
||||
|
||||
echo json_encode(get_locale_list());
|
||||
echo json_encode(get_locale_list());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user