Return true if the user can assign news categories.

@return bool
357698
public function canUserAssignCategories()
    {
        $user = $this->getUser();

        return $user->isAdmin || \in_array('tl_news::categories', $user->alexf, true);
    }
343000
public function edit(News $news)
    {
        $categories = NewsCategory::getAllList();

        return $this->view('titan::news_events.create_edit', compact('categories'))->with('item', $news);
    }
46253
public function isAllowedToNotify()
    {
        if (!$this->node->isPublished()) {
            return false;
        }

        return $this->showNotification($this->node, $this->node->isPublished());
    }
587145
protected function validateCategoryGroup()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->category_group->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Category group'));
            return false;
        }

        $this->setUpdating($data);
        return true;
    }
934033
def user_can_edit_newsitem(user, NewsItem):
    
    for perm in format_perms(NewsItem, ['add', 'change', 'delete']):
        if user.has_perm(perm):
            return True

    return False
1022220
public function canRate()
    {
        if ($this->_blRate === null) {
            $this->_blRate = false;
            if (($oActObject = $this->_getActiveObject()) && ($oRevUser = $this->getReviewUser())) {
                $oRating = oxNew(\OxidEsales\Eshop\Application\Model\Rating::class);
                $this->_blRate = $oRating->allowRating(
                    $oRevUser->getId(),
                    $this->_getActiveType(),
                    $oActObject->getId()
                );
            }
        }

        return $this->_blRate;
    }
1143885
function categoryExist($title){
        if(self::where('title',$title)->where('model_type',$this->modelType)->first())
            return true;

        return false;
    }
1243644
public function hasContent() {

    if (count($this->getCategories()) == 0) {
      return FALSE;
    }

    if (count($this->getAllChildren()) == 0) {
      return FALSE;
    }

    return TRUE;
  }
444000
public function HasBasketContentRestrictions()
    {
        $bHasArticleRestriction = $this->GetFromInternalCache('bHasArticleRestriction');
        if (is_null($bHasArticleRestriction)) {
            $aCategoryRestrictons = $this->GetMLTIdList('shop_category_mlt');
            $bHasArticleRestriction = (count($aCategoryRestrictons) > 0);
            if (!$bHasArticleRestriction) {
                $aArticleRestrictons = $this->GetMLTIdList('shop_article_mlt');
                $bHasArticleRestriction = (count($aArticleRestrictons) > 0);
            }
            $this->SetInternalCache('bHasArticleRestriction', $bHasArticleRestriction);
        }

        return $bHasArticleRestriction;
    }
650725
public function canAccess()
    {
        // Admin can access everything, no point in checking.
        $member = Security::getCurrentUser();
        if ($member
            && (Permission::checkMember($member, [
                'ADMIN', // Full administrative rights
                'CMS_ACCESS_LeftAndMain', // Access to all CMS sections
                'CMS_ACCESS_CMSMain', // Access to CMS controllers
            ]))
        ) {
            return true;
        }

        // Check if we have access to current section on the current subsite.
        $accessibleSites = $this->owner->sectionSites(true, 'Main site', $member);
        return $accessibleSites->count() && $accessibleSites->find('ID', SubsiteState::singleton()->getSubsiteId());
    }
520690
public function canCreateCategories($member = null)
    {
        $member = $this->getMember($member);

        $parent = $this->Parent();

        if (!$parent || !$parent->exists() || !($parent instanceof Blog)) {
            return false;
        }

        if ($parent->isEditor($member)) {
            return true;
        }

        return Permission::checkMember($member, 'ADMIN');
    }
357120
public function canModify()
    {
        if ( ! $this->getEnabledList()
                    ->canModify() )
        {
            return false;
        }

        $modules = $this->getModuleManager()
                        ->getModules();

        if ( ! in_array( 'Grid\MultisitePlatform', $modules ) )
        {
            return true;
        }

        return in_array( 'Grid\MultisiteCentral', $modules );
    }
265677
public function canEdit()
    {
        if($this->getMixer() instanceof KControllerModellable)
        {
            $user = $this->getUser();
            if ($user->isAuthentic() && $user->isEnabled()) {
                return true;
            }
        }

        return false;
    }
1146390
protected function canAccess()
    {
        $result = false;
        $page = Page::getByPath('/dashboard/system/basics/editor');
        if ($page && !$page->isError()) {
            $checker = new Checker($page);
            $result = $checker->canViewPage();
        }

        return $result;
    }
735527
public boolean isAnyCategorical(){
    int cnt =0;
    for(int i=0;i<_cols.length;++i) {
      if( !_cols[i]._ignored && !_cols[i]._response && _cols[i]._isCategorical) {
        cnt = 1;
        break;
      }
    }
    if(cnt ==1) return true;
    else return false;
  }
929572
protected function ensure_categories_loaded() {
        global $DB;
        $this->ensure_category_loaded();
        if (!is_null(end($this->_categories))) {
            return; // Already done.
        }
        $idstoload = array_keys($this->_categories);
        array_shift($idstoload);
        $categories = $DB->get_records_list('course_categories', 'id', $idstoload);
        foreach ($idstoload as $catid) {
            $this->_categories[$catid] = $categories[$catid];
        }
    }
85441
public function isLeap()
    {
        if (0 !== $this->year % 4) {
            return false;
        }

        if (0 !== $this->year % 100) {
            return true;
        }

        if (0 !== $this->year % 400) {
            return false;
        }

        return true;
    }