All users can now be limited to certain preorder networks
This commit is contained in:
@@ -197,6 +197,28 @@ class User extends mfBaseModel {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function can($what) {
|
||||
if(!$this->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!is_array($what)) {
|
||||
$what = [$what];
|
||||
}
|
||||
|
||||
//ob_end_clean();var_dump($what, $this->permissions);exit;
|
||||
foreach($what as $w) {
|
||||
$perm = ucfirst(strtolower($w));
|
||||
if(is_object($this->permissions) && property_exists($this->permissions->data, "can$perm")) {
|
||||
if($this->permissions->{"can$perm"} === "true") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isAdmin() {
|
||||
if(is_object($this->permissions) && property_exists($this->permissions, "isAdmin")) {
|
||||
return $this->permissions->isAdmin;
|
||||
|
||||
@@ -202,7 +202,7 @@ class UserController extends mfBaseController
|
||||
|
||||
// save networks
|
||||
$pn = $user->getFlag("preorder_networks");
|
||||
if ($r->preorderfront == "true" && is_array($r->preorder_networks) && count($r->preorder_networks)) {
|
||||
if (is_array($r->preorder_networks) && count($r->preorder_networks)) {
|
||||
$pn->value(json_encode($r->preorder_networks));
|
||||
$pn->save();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user