['email']]; protected function _getFromColumns() { $columns = parent::_getFromColumns(); $columns['ipTitle'] = $this->_getIpTitleExp(); $columns['sessionClosedDate'] = $this->_getSessionClosedDateExp(); return $columns; } protected function _getIpTitleExp() { return new Zend_Db_Expr('INET_NTOA(ip)'); } protected function _getSessionClosedDateExp() { return new Zend_Db_Expr('IF(`s`.`closed` = "y", `s`.`changed`, NULL)'); } public function appendFilterFields($filterField) { array_push($this->_filterFields, $filterField); return $this; } protected function _filter(Zend_Db_Select $select) { parent::_filter($select); $select->where('`action` = ?', self::ACTION_LOGIN); if ($this->getFilter('role') == self::ROLE_ADMIN) { if (AclPermission::isTribalAccount()) { $select->where('`type` = ?', AdminObj::TYPE_TRIBAL_ACCOUNT); $select->where('`tribeId` = ?', AclPermission::getAdminTribeId()); } elseif ( !in_array(App_Admin_Acl::ACL_TRIBAL_ACCOUNTS_ID, AclPermission::getAllowedResources()) && !in_array(App_Admin_Acl::ACL_TRIBAL_ACCOUNTS_READ_ID, AclPermission::getAllowedResources()) ) { $select->where('`type` = ?', AdminObj::TYPE_ADMIN); } elseif ( (in_array(App_Admin_Acl::ACL_TRIBAL_ACCOUNTS_ID, AclPermission::getAllowedResources()) || in_array(App_Admin_Acl::ACL_TRIBAL_ACCOUNTS_READ_ID, AclPermission::getAllowedResources())) && !in_array(App_Admin_Acl::ACL_ADMIN_ACTIVITY_ID, AclPermission::getAllowedResources()) ) { $select->where('`type` = ?', AdminObj::TYPE_TRIBAL_ACCOUNT); } } return $this; } public function getRoleOptions() { $options = []; switch ($this->getFilter('role')) { case self::ROLE_ADMIN: $where = null; if (AclPermission::isTribalAccount()) { $where = [ 'type' => AdminObj::TYPE_TRIBAL_ACCOUNT, 'tribeId' => AclPermission::getAdminTribeId() ]; } elseif ( !in_array(App_Admin_Acl::ACL_TRIBAL_ACCOUNTS_ID, AclPermission::getAllowedResources()) && !in_array(App_Admin_Acl::ACL_TRIBAL_ACCOUNTS_READ_ID, AclPermission::getAllowedResources()) ) { $where = ['type' => AdminObj::TYPE_ADMIN]; } elseif ( (in_array(App_Admin_Acl::ACL_TRIBAL_ACCOUNTS_ID, AclPermission::getAllowedResources()) || in_array(App_Admin_Acl::ACL_TRIBAL_ACCOUNTS_READ_ID, AclPermission::getAllowedResources())) && !in_array(App_Admin_Acl::ACL_ADMIN_ACTIVITY_ID, AclPermission::getAllowedResources()) ) { $where = ['type' => AdminObj::TYPE_TRIBAL_ACCOUNT]; } $options = $this->_get4Select( 'Admin', ['id', new Zend_Db_Expr($this->_getRoleNameColumn())], $where ); break; case self::ROLE_USER: $options = $this->_get4Select('User', ['id', new Zend_Db_Expr($this->_getRoleNameColumn())]); break; default: $this->_throw(); break; } return $options; } }