当前位置: 首页>>代码示例>>PHP>>正文


PHP USER::isLoggedIn方法代码示例

本文整理汇总了PHP中OCP\USER::isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP USER::isLoggedIn方法的具体用法?PHP USER::isLoggedIn怎么用?PHP USER::isLoggedIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\USER的用法示例。


在下文中一共展示了USER::isLoggedIn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteCalendar

 /**
  * @NoAdminRequired
  */
 public function deleteCalendar()
 {
     $calId = (int) $this->params('calendarid');
     $del = CalendarCalendar::deleteCalendar($calId);
     if ($del === true) {
         $calendars = CalendarCalendar::allCalendars($this->userId, false, false, false);
         $bNewId = null;
         //\OCP\Util::writeLog($this->appName, 'DEL COUNT-> '.count($calendars).$calendars[0]['id'], \OCP\Util::DEBUG);
         if (\OCP\USER::isLoggedIn() && count($calendars) === 0) {
             $bNewId = CalendarCalendar::addDefaultCalendars($this->userId);
         }
         $params = ['status' => 'success', 'newid' => $bNewId];
     } else {
         $params = ['status' => 'error'];
     }
     $response = new JSONResponse($params);
     return $response;
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:21,代码来源:calendarcontroller.php

示例2: delete

 /**
  * removes a calendar
  * @param integer $id
  * @param boolean $bLogActivity
  * @return associative array
  */
 public function delete($id, $bLogActivity = true)
 {
     $calendar = $this->find($id);
     //\OCP\Util::writeLog('DAV', 'DEL ID-> '.$id, \OCP\Util::DEBUG);
     $group = \OC::$server->getGroupManager()->get('admin');
     $this->setUserId(\OCP\User::getUser());
     if ($calendar['userid'] !== $this->userId && !$group->inGroup($this->userId)) {
         $sharedCalendar = $this->shareConnector->getItemSharedWithBySourceCalendar($id);
         if (!$sharedCalendar || !($sharedCalendar['permissions'] & $this->shareConnector->getDeleteAccess())) {
             throw new \Sabre\DAV\Exception\Forbidden('You do not have the permissions to delete this calendar.');
         }
     }
     $calendarDB = new CalendarDAO($this->db, $this->userId);
     $bDeleteCalendar = $calendarDB->delete($id);
     if ($bDeleteCalendar === true) {
         \OCP\Util::emitHook('\\OCA\\CalendarPlus', 'deleteCalendar', $id);
         $this->deleteObjects($id);
         $this->shareConnector->unshareAllCalendar($id);
         $app = new Application();
         $c = $app->getContainer();
         $repeatController = $c->query('RepeatController');
         $repeatController->cleanCalendar($id);
         $calendars = $this->all(false, false);
         if (\OCP\USER::isLoggedIn() && count($calendars) === 0 || count($calendars) === 1 && $calendars[0]['id'] === 'birthday_' . $this->userId) {
             //self::addDefaultCalendars($user);
         }
         if ($bLogActivity === true) {
             $link = \OC::$server->getURLGenerator()->linkToRoute('calendarplus.page.index');
             $params = array('mode' => 'deleted', 'link' => $link, 'trans_type' => '', 'summary' => $calendar['displayname'], 'cal_user' => $this->userId, 'cal_displayname' => $calendar['displayname']);
             ActivityData::logEventActivity($params, false, true);
         }
         return $bDeleteCalendar;
     } else {
         return $bDeleteCalendar;
     }
 }
开发者ID:sahne123,项目名称:calendarplus,代码行数:42,代码来源:calendarconnector.php

示例3: getPermissions

 /**
  * @brief Get the permissions for a calendar / an event
  * @param (int) $id - id of the calendar / event
  * @param (string) $type - type of the id (calendar/event)
  * @return (int) $permissions - CRUDS permissions
  * @param (string) $accessclass - access class (rfc5545, section 3.8.1.3)
  * @see \OCP\Share
  */
 public static function getPermissions($id, $type, $accessclass = '')
 {
     $permissions_all = \OCP\PERMISSION_ALL;
     if ($type == self::CALENDAR) {
         $calendar = self::getCalendar($id, false, false);
         if ($calendar['userid'] == \OCP\USER::getUser()) {
             if (isset($calendar['issubscribe'])) {
                 $permissions_all = \OCP\PERMISSION_READ;
             }
             return $permissions_all;
         } else {
             $sharedCalendar = \OCP\Share::getItemSharedWithBySource(self::SHARECALENDAR, App::SHARECALENDARPREFIX . $id);
             if ($sharedCalendar) {
                 return $sharedCalendar['permissions'];
             }
         }
     } elseif ($type == self::EVENT) {
         $object = Object::find($id);
         $cal = Calendar::find($object['calendarid']);
         if ($cal['userid'] == \OCP\USER::getUser()) {
             if ($cal['issubscribe']) {
                 $permissions_all = \OCP\PERMISSION_READ;
             }
             return $permissions_all;
         } else {
             if (\OCP\USER::isLoggedIn()) {
                 $sharedCalendar = \OCP\Share::getItemSharedWithBySource(self::SHARECALENDAR, self::SHARECALENDARPREFIX . $object['calendarid']);
                 $sharedEvent = \OCP\Share::getItemSharedWithBySource(self::SHAREEVENT, self::SHAREEVENTPREFIX . $id);
                 $calendar_permissions = 0;
                 $event_permissions = 0;
                 if ($sharedCalendar) {
                     $calendar_permissions = $sharedCalendar['permissions'];
                 }
                 if ($sharedEvent) {
                     $event_permissions = $sharedEvent['permissions'];
                 }
             }
             if (!\OCP\USER::isLoggedIn()) {
                 //\OCP\Util::writeLog('calendar', __METHOD__ . ' id: ' . $id . ', NOT LOGGED IN: ', \OCP\Util::DEBUG);
                 $sharedByLinkCalendar = \OCP\Share::getItemSharedWithByLink(self::SHARECALENDAR, self::SHARECALENDARPREFIX . $object['calendarid'], $cal['userid']);
                 if ($sharedByLinkCalendar) {
                     $calendar_permissions = $sharedByLinkCalendar['permissions'];
                     $event_permissions = 0;
                 }
             }
             if ($accessclass === 'PRIVATE') {
                 return 0;
             } elseif ($accessclass === 'CONFIDENTIAL') {
                 return \OCP\PERMISSION_READ;
             } else {
                 return max($calendar_permissions, $event_permissions);
             }
         }
     }
     return 0;
 }
开发者ID:Bullnados,项目名称:calendarplus,代码行数:64,代码来源:app.php

示例4: deleteCalendar

 /**
  * @brief removes a calendar
  * @param integer $id
  * @return boolean
  */
 public static function deleteCalendar($id)
 {
     $calendar = self::find($id);
     //\OCP\Util::writeLog('DAV', 'DEL ID-> '.$id, \OCP\Util::DEBUG);
     $group = \OC::$server->getGroupManager()->get('admin');
     $user = \OCP\User::getUser();
     if ($calendar['userid'] != $user && !$group->inGroup($user)) {
         $sharedCalendar = \OCP\Share::getItemSharedWithBySource(App::SHARECALENDAR, App::SHARECALENDARPREFIX . $id);
         if (!$sharedCalendar || !($sharedCalendar['permissions'] & \OCP\PERMISSION_DELETE)) {
             throw new \Exception(App::$l10n->t('You do not have the permissions to delete this calendar.'));
         }
     }
     $stmt = \OCP\DB::prepare('DELETE FROM `' . App::CldCalendarTable . '` WHERE `id` = ?');
     $stmt->execute(array($id));
     $stmt = \OCP\DB::prepare('DELETE FROM `' . App::CldObjectTable . '` WHERE `calendarid` = ?');
     $stmt->execute(array($id));
     \OCP\Share::unshareAll(App::SHARECALENDAR, App::SHARECALENDARPREFIX . $id);
     \OCP\Util::emitHook('\\OCA\\CalendarPlus', 'deleteCalendar', $id);
     $calendars = self::allCalendars(\OCP\USER::getUser(), false, false);
     if (\OCP\USER::isLoggedIn() && count($calendars) === 0 || count($calendars) == 1 && $calendars[0]['id'] == 'birthday_' . \OCP\USER::getUser()) {
         self::addDefaultCalendars(\OCP\USER::getUser());
     }
     $link = \OC::$server->getURLGenerator()->linkToRoute(App::$appname . '.page.index');
     $params = array('mode' => 'deleted', 'link' => $link, 'trans_type' => '', 'summary' => $calendar['displayname'], 'cal_user' => $user, 'cal_displayname' => $calendar['displayname']);
     ActivityData::logEventActivity($params, false, true);
     return true;
 }
开发者ID:Bullnados,项目名称:calendarplus,代码行数:32,代码来源:calendar.php

示例5: getPermissions

 /**
  * @brief Get the permissions for a calendar / an event
  * @param (int) $id - id of the calendar / event
  * @param (string) $type - type of the id (calendar/event)
  * @return (int) $permissions - CRUDS permissions
  * @param (string) $accessclass - access class (rfc5545, section 3.8.1.3)
  * @see \OCP\Share
  */
 public static function getPermissions($id, $type, $accessclass = '')
 {
     $permissions_all = \OCP\PERMISSION_ALL;
     if ($type === self::CALENDAR) {
         $calendar = self::getCalendar($id, false, false);
         if ($calendar['userid'] === \OCP\USER::getUser()) {
             return $permissions_all;
         } else {
             $sharedCalendar = \OCP\Share::getItemSharedWithBySource(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $id);
             if ($sharedCalendar) {
                 return $sharedCalendar['permissions'];
             }
         }
     } elseif ($type == self::TODO) {
         if (Object::getowner($id) === \OCP\USER::getUser()) {
             return $permissions_all;
         } else {
             $object = Object::find($id);
             $cal = Calendar::find($object['calendarid']);
             if (\OCP\USER::isLoggedIn()) {
                 $sharedCalendar = \OCP\Share::getItemSharedWithBySource(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $object['calendarid']);
                 $sharedEvent = \OCP\Share::getItemSharedWithBySource(CalendarApp::SHARETODO, CalendarApp::SHARETODOPREFIX . $id);
                 $calendar_permissions = 0;
                 $event_permissions = 0;
                 if ($sharedCalendar) {
                     $calendar_permissions = $sharedCalendar['permissions'];
                 }
                 if ($sharedEvent) {
                     $event_permissions = $sharedEvent['permissions'];
                 }
             }
             if (!\OCP\USER::isLoggedIn()) {
                 $sharedByLinkCalendar = \OCP\Share::getItemSharedWithByLink(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $object['calendarid'], $cal['userid']);
                 if ($sharedByLinkCalendar) {
                     $calendar_permissions = $sharedByLinkCalendar['permissions'];
                     $event_permissions = 0;
                 }
             }
             if ($accessclass === 'PRIVATE') {
                 return 0;
             } elseif ($accessclass === 'CONFIDENTIAL') {
                 return \OCP\PERMISSION_READ;
             } else {
                 return max($calendar_permissions, $event_permissions);
             }
         }
     }
     return 0;
 }
开发者ID:ejouvin,项目名称:tasksplus,代码行数:57,代码来源:app.php


注:本文中的OCP\USER::isLoggedIn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。