/**
  * True if member can be edited
  * @param Membergroup $group
  * @return bool
  */
 protected function CanEdit(Membergroup $group)
 {
     return self::Guard()->Allow(BackendAction::Edit(), $group) && self::Guard()->Allow(BackendAction::UseIt(), new MembergroupForm());
 }
Example #2
0
 /**
  * True if member can be edited
  * @param Member $member
  * @return bool
  */
 protected function CanEdit(Member $member)
 {
     return self::Guard()->Allow(BackendAction::Edit(), $member) && self::Guard()->Allow(BackendAction::UseIt(), new MemberForm());
 }
Example #3
0
 /**
  * True if area can be edited
  * @param Area $area
  * @return bool Returns true if the area can be edited
  */
 protected function CanEdit(Area $area)
 {
     return self::Guard()->Allow(BackendAction::Edit(), $area) && self::Guard()->Allow(BackendAction::UseIt(), new AreaForm());
 }
Example #4
0
 /**
  * True if site can be edited
  * @param Site $site
  * @return bool
  */
 protected function CanEdit(Site $site)
 {
     return self::Guard()->Allow(BackendAction::Edit(), $site) && self::Guard()->Allow(BackendAction::UseIt(), new SiteForm());
 }
Example #5
0
 /**
  * True if page is editable
  * @param Page $page
  * @return bool
  */
 protected function CanEdit()
 {
     return BackendModule::Guard()->Allow(BackendAction::Edit(), $this->page);
 }
Example #6
0
 /**
  * True if the layout can be edited
  * @param Layout $layout
  * @return bool
  */
 protected function CanEdit(Layout $layout)
 {
     return self::Guard()->Allow(BackendAction::Edit(), $layout);
 }
Example #7
0
 private function GrantOnUser(BackendAction $action, User $user)
 {
     $allowed = false;
     switch ($action) {
         case BackendAction::Delete():
         case BackendAction::ChangeIsAdmin():
             $allowed = $this->IsAdministrator() && !$this->GetUser()->Equals($user);
             break;
         case BackendAction::AssignGroups():
             $allowed = $this->IsAdministrator() && !$user->GetIsAdmin();
             break;
         case BackendAction::Edit():
         case BackendAction::Read():
             $allowed = $this->IsAdministrator() || $this->GetUser()->Equals($user);
             break;
         case BackendAction::Create():
             $allowed = $this->IsAdministrator();
             break;
     }
     return $allowed ? GrantResult::Allowed() : GrantResult::NoAccess();
 }
Example #8
0
 /**
  * True if the the content can be edited
  * @return Boolean
  */
 protected final function CanEdit()
 {
     $form = $this->module->ContentForm();
     return BackendModule::Guard()->Allow(BackendAction::Edit(), $this->content) && BackendModule::Guard()->Allow(BackendAction::Read(), $form);
 }
Example #9
0
 /**
  * True if a new user group can be created
  * @return bool
  */
 protected function CanCreate()
 {
     return self::Guard()->Allow(BackendAction::Edit(), new Usergroup());
 }
Example #10
0
 /**
  * True if the container can be edited
  * @param Container $container
  * @return boolean
  */
 protected function CanEdit(Container $container)
 {
     return self::Guard()->Allow(BackendAction::Edit(), $container) && self::Guard()->Allow(BackendAction::UseIt(), new ContainerForm());
 }