1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00
This commit is contained in:
Mzhelskiy Maxim 2015-11-09 17:03:23 +07:00
parent a435efe7d3
commit 5a02559269
4 changed files with 16 additions and 9 deletions

View file

@ -57,13 +57,7 @@ class ModuleACL extends Module
if (!$oUser) { if (!$oUser) {
return false; return false;
} }
if ($oUser->isAdministrator()) { if (!$oUser->isAllowCreateBlog()) {
return true;
}
/**
* Проверяем хватает ли рейтинга юзеру чтоб создать блог
*/
if ($oUser->getRating() < Config::Get('acl.create.blog.rating')) {
return $that->Lang_Get('blog.add.alerts.acl'); return $that->Lang_Get('blog.add.alerts.acl');
} }
return true; return true;

View file

@ -633,6 +633,19 @@ class ModuleUser_EntityUser extends Entity
return false; return false;
} }
/**
* Проверка на возможность создания блога юзером
*
* @return bool
*/
public function isAllowCreateBlog()
{
if ($this->isAdministrator() or $this->getRating() >= Config::Get('acl.create.blog.rating')) {
return true;
}
return false;
}
/** /**
* Устанавливает ID пользователя * Устанавливает ID пользователя

View file

@ -4,7 +4,7 @@
{if $oUserCurrent} {if $oUserCurrent}
{capture 'block_content'} {capture 'block_content'}
{if $oUserCurrent && ($oUserCurrent->getRating() > Config::Get('acl.create.blog.rating') or $oUserCurrent->isAdministrator())} {if $oUserCurrent && $oUserCurrent->isAllowCreateBlog()}
<p>{$aLang.blog.can_add}</p> <p>{$aLang.blog.can_add}</p>
{component 'button' url="{router page='blog'}add/" mods='primary large' text=$aLang.blog.create_blog} {component 'button' url="{router page='blog'}add/" mods='primary large' text=$aLang.blog.create_blog}

@ -1 +1 @@
Subproject commit fce2a720edf08e411eee114c3de1712294a5a08e Subproject commit 6e84853becbd465cfbb2e9bc721ad808206eaff7