users = new ArrayCollection(); $this->acl_attributes = []; } public function setID($id) { // example ROLE_SUPER_ADMIN, ROLE_CASHIER, etc $this->id = $id; return $this; } public function getID() { return $this->id; } public function setName($name) { $this->name = $name; return $this; } public function getName() { return $this->name; } public function getUsers() { return $this->users; } public function getUsersCount() { return $this->users->count(); } public function isSuperAdmin() { if ($this->id == self::SUPER_ADMIN) return true; return false; } // TODO: shift out ACL stuff to its own class public function clearACLAttributes() { $this->acl_attributes = []; return $this; } public function getACLAttributes() { return $this->acl_attributes; } public function addACLAccess($attribute) { $this->acl_attributes[$attribute] = true; return $this; } public function hasACLAccess($attribute) { // if it's super admin, they always have access if ($this->isSuperAdmin()) return true; // check ACL attributes if (isset($this->acl_attributes[$attribute]) && $this->acl_attributes[$attribute]) return true; return false; } }