Determine if this member can moderate comments in the CMS

@param Member $member

@return boolean
347046
public function canModerateComments($member = null)
    {
        // Deny if not enabled for this object
        if (!$this->owner->CommentsEnabled) {
            return false;
        }

        // Fallback to can-edit
        return $this->owner->canEdit($member);
    }
1249701
public function isEditor($member)
    {
        $isEditor = $this->isMemberOf($member, $this->Editors());
        $this->extend('updateIsEditor', $isEditor, $member);

        return $isEditor;
    }
1029737
protected function userHasAccess($member)
    {
        if (!$member) {
            if (!Security::getCurrentUser()) {
                return false;
            }
            $member = Security::getCurrentUser();
        }

        if (Permission::checkMember($member, "ADMIN")) {
            return true;
        }

        // This method primarily "protects" access to a WorkflowInstance, but assumes access only to be granted to
        // users assigned-to that WorkflowInstance. However; lowly authors (users entering items into a workflow) are
        // not assigned - but we still wish them to see their submitted content.
        $inWorkflowGroupOrUserTables = ($member->inGroups($this->Groups()) || $this->Users()->find('ID', $member->ID));
        // This method is used in more than just the ModelAdmin. Check for the current controller to determine where
        // canView() expectations differ
        if ($this->getTarget() && Controller::curr()->getAction() == 'index' && !$inWorkflowGroupOrUserTables) {
            if ($this->getVersionedConnection($this->getTarget()->ID, $member->ID)) {
                return true;
            }
            return false;
        }
        return $inWorkflowGroupOrUserTables;
    }
1035464
public function canView($member = null)
    {
        if (!$member && $member !== false) {
            $member = Security::getCurrentUser();
        }

        if (!parent::canView($member)) {
            return false;
        }

        foreach ($this->Reports() as $report) {
            if ($report->canView($member)) {
                return true;
            }
        }

        return false;
    }
1232791
public function canView($member = null)
    {
        if (!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
            $member = Security::getCurrentUser()->ID;
        }

        // admin override
        if ($member && Permission::checkMember($member, ['ADMIN', 'SITETREE_VIEW_ALL'])) {
            return true;
        }

        // Standard mechanism for accepting permission changes from extensions
        $extended = $this->extendedCan('canView', $member);
        if ($extended !== null) {
            return $extended;
        }

        // check for empty spec
        if (!$this->CanViewType || $this->CanViewType == 'Anyone') {
            return true;
        }

        // check for any logged-in users
        if ($this->CanViewType == 'LoggedInUsers' && $member) {
            return true;
        }

        // check for specific groups
        if ($member && is_numeric($member)) {
            $member = Member::get()->byID($member);
        }
        if ($this->CanViewType == 'OnlyTheseUsers' && $member && $member->inGroups($this->ViewerGroups())) {
            return true;
        }

        return false;
    }
1160452
public function canView($member = null)
    {
        if (!$member) {
            $member = Security::getCurrentUser();
        }

        // extended access checks
        $results = $this->extend('canView', $member);
        if ($results && is_array($results)) {
            if (!min($results)) {
                return false;
            }
        }

        // user needs access to CMS_ACCESS_SecurityAdmin
        if (Permission::checkMember($member, "CMS_ACCESS_SecurityAdmin")) {
            return true;
        }

        return false;
    }
456978
public function canComment($user = null)
    {
        if ($this->getCommentStatus()->getId() == ArticleCommentStatus::ARTICLE_COMMENTS_OFF) {
            return false;
        }

        if ($this->getCommentStatus()->getId() == ArticleCommentStatus::ARTICLE_COMMENTS_INTERNAL) {
            if ($user && $user->isLoggedIn()) {
                return true;
            } else {
                return false;
            }
        }

        if ($this->getCommentStatus()->getId() == ArticleCommentStatus::ARTICLE_COMMENTS_ON) {
            return true;
        }

        return false;
    }
466867
public function canApprove($member = null) {
		if(!$member) $member = Member::currentUser();
		if(!$member) return false;

		if(Permission::checkMember($member, 'ADMIN')) return true;
		return $this->PipelineApprovers()->byID($member->ID)
			|| $member->inGroups($this->PipelineApproverGroups());
	}
1327392
public function isUnreadByUser($member = null) {
		if (!$member) {
			$member = $this->securityContext->getMember();
		}

		if ($member && $member->ID) {
			return strtotime($this->Created) > strtotime($member->LastPostView);
		}
	}
833688
public function canView($member = null)
    {
        $extended = $this->extendedCan(__FUNCTION__, $member);

        if ($extended !== null) {
            return $extended;
        }

        if ($this->Parent()) {
            return $this->Parent()->canView($member);
        }

        return parent::canView($member);
    }
525818
public function contains($member): bool
    {
        return $member instanceof Resource && $member->uri &&
            $this->findURI($member->uri) >= 0;
    }
192198
public function canEditWriters($member = null)
    {
        $member = $this->getMember($member);

        $extended = $this->extendedCan('canEditWriters', $member);

        if ($extended !== null) {
            return $extended;
        }

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

        return Permission::checkMember($member, self::MANAGE_USERS);
    }
1316641
protected function isMemberOf($member, $relation)
    {
        if (!$member || !$member->exists()) {
            return false;
        }

        if ($relation instanceof UnsavedRelationList) {
            return in_array($member->ID, $relation->getIDList());
        }

        return $relation->byID($member->ID) !== null;
    }
514296
protected function actionLink($action, $member = null)
    {
        if (!$member) {
            $member = Member::currentUser();
        }
        if (!$member) {
            return false;
        }

        /**
         * @todo: How do we handle "DataObject" instances that don't have a Link to reject/spam/delete?? This may
         * we have to make CMS a hard dependency instead.
         */
        // if (!$this->Parent()->hasMethod('Link')) {
        //     return false;
        // }

        $url = Controller::join_links(
            Director::baseURL(),
            'comments',
            $action,
            $this->ID
        );

        // Limit access for this user
        $token = $this->getSecurityToken();
        return $token->addToUrl($url, $member);
    }
1238192
public function onSkipRegistration(Member $member)
    {
        $this->getAuditLogger()->info(sprintf(
            '"%s" (ID: %s) skipped MFA registration',
            $member->Email ?: $member->Title,
            $member->ID
        ));
    }
704494
public function getCommentsEnabled()
    {
        // Don't display comments form for pseudo-pages (such as the login form)
        if (!$this->owner->exists()) {
            return false;
        }

        // Determine which flag should be used to determine if this is enabled
        if ($this->owner->getCommentsOption('enabled_cms')) {
            return (bool) $this->owner->ProvideComments;
        }

        return (bool) $this->owner->getCommentsOption('enabled');
    }
521006
public function canEdit($member = null)
    {
        if (!$member) {
            $member = Security::getCurrentUser();
        }

        // extended access checks
        $results = $this->extend('canEdit', $member);
        if ($results && is_array($results)) {
            if (!min($results)) {
                return false;
            }
        }

        if (// either we have an ADMIN
            (bool)Permission::checkMember($member, "ADMIN")
            || (
                // or a privileged CMS user and a group without ADMIN permissions.
                // without this check, a user would be able to add himself to an administrators group
                // with just access to the "Security" admin interface
                Permission::checkMember($member, "CMS_ACCESS_SecurityAdmin") &&
                !Permission::get()->filter(array('GroupID' => $this->ID, 'Code' => 'ADMIN'))->exists()
            )
        ) {
            return true;
        }

        return false;
    }