Ejemplo n.º 1
0
 /**
  * action 의 permission 설정 반환
  *
  * @param string $instanceId instance identifier
  * @return array
  */
 public function getPerms($instanceId)
 {
     $registered = $this->get($instanceId)->getRegistered();
     $perms = [];
     foreach ($this->actions as $action) {
         $pureGrant = $registered->pure($action);
         $mode = $pureGrant === null ? "inherit" : "manual";
         $perms[] = ['mode' => $mode, 'title' => $action, 'grant' => $this->getGrant($registered, $action), 'groups' => $this->assignor->all()];
     }
     return $perms;
 }
 public function edit($id)
 {
     $member = $this->members->find($id, ['groups', 'mails', 'accounts']);
     if ($member === null) {
         $e = new InvalidArgumentHttpException();
         $e->setMessage('존재하지 않는 회원입니다.');
         throw $e;
     }
     $ratings = Rating::getUsableAll();
     $ratingNames = ['member' => '일반', 'manager' => '관리자', 'super' => '최고관리자'];
     foreach ($ratings as $key => $rating) {
         $ratings[$key] = ['value' => $rating, 'text' => $ratingNames[$rating]];
         if ($rating === $member->rating) {
             $ratings[$key]['selected'] = 'selected';
         }
     }
     $groupEntities = $this->groups->all();
     $groups = [];
     $joinedGroups = array_pluck($member->groups ?: [], 'id');
     foreach ($groupEntities as $key => $group) {
         $groups[$key] = ['value' => $group->id, 'text' => $group->name];
         if (in_array($group->id, $joinedGroups)) {
             $groups[$key]['checked'] = 'checked';
         }
     }
     $status = [Member::STATUS_ACTIVATED => ['value' => Member::STATUS_ACTIVATED, 'text' => '승인됨'], Member::STATUS_DENIED => ['value' => Member::STATUS_DENIED, 'text' => '거부됨']];
     $status[$member->status]['selected'] = 'selected';
     // profileImage config
     $profileImgSize = config('xe.member.profileImage.size');
     // dynamic field
     $dynamicField = app('xe.dynamicField');
     $fieldTypes = $dynamicField->gets('member');
     $defaultAccount = null;
     if (isset($member->accounts)) {
         foreach ($member->accounts as $account) {
             if ($account->provider === Member::PROVIDER_DEFAULT) {
                 $defaultAccount = $account;
             }
         }
     }
     return Presenter::make('member.settings.member.edit', compact('member', 'ratings', 'groups', 'status', 'defaultAccount', 'fieldTypes', 'profileImgSize'));
 }
Ejemplo n.º 3
0
 /**
  * searchGroup
  *
  * @param GroupRepositoryInterface $groupRepo
  * @param null                     $keyword
  *
  * @return \Xpressengine\Presenter\RendererInterface
  */
 public function searchGroup(GroupRepositoryInterface $groupRepo, $keyword = null)
 {
     if ($keyword === null) {
         return Presenter::makeApi($groupRepo->all());
     }
     $matchedGroupList = $groupRepo->search(['name' => $keyword])->items();
     return Presenter::makeApi($matchedGroupList);
 }