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


PHP UserAuth::getDefaultPermissions方法代码示例

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


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

示例1: bulkRoleChange

 /**
  * Bulk User Role Change
  *
  * @param string $from name of role to move from
  * @param string $to name of role to move to
  * @return bool
  */
 public function bulkRoleChange($h, $from = '', $to = '')
 {
     if (!$from || !$to) {
         return false;
     }
     // check $from and $to exist
     $unique_roles = $this->getUniqueRoles($h);
     if (!in_array($from, $unique_roles)) {
         return false;
     }
     if (!in_array($to, $unique_roles)) {
         return false;
     }
     $sql = "SELECT user_id FROM " . TABLE_USERS . " WHERE user_role = %s";
     $items = $h->db->get_results($h->db->prepare($sql, $from));
     if ($items) {
         // Change role and permissions for each user being moved
         foreach ($items as $item) {
             $user = new UserAuth();
             $user->getUser($h, $item->user_id);
             $user->role = $to;
             $new_perms = $user->getDefaultPermissions($h, $user->role);
             $user->setAllPermissions($new_perms);
             $user->updateUserBasic($h);
         }
     }
     return true;
 }
开发者ID:hotarucms,项目名称:hotarucms,代码行数:35,代码来源:UserBase.php

示例2: checkEmailConfirmation

 /**
  * Check email confirmation code
  *
  * @return true;
  */
 public function checkEmailConfirmation($h)
 {
     $user_id = $h->cage->get->getInt('id');
     $conf = $h->cage->get->getAlnum('conf');
     $user = new UserAuth();
     $user->getUserBasic($h, $user_id);
     if (!$user_id || !$conf) {
         $h->messages[$h->lang['user_signin_register_emailconf_fail']] = 'red';
     }
     $sql = "SELECT user_email_conf FROM " . TABLE_USERS . " WHERE user_id = %d";
     $user_email_conf = $h->db->get_var($h->db->prepare($sql, $user_id));
     if ($conf === $user_email_conf) {
         // update role:
         $user->role = $h->vars['regStatus'];
         $h->pluginHook('user_signin_email_conf_post_role');
         // update user with new permissions:
         $new_perms = $user->getDefaultPermissions($h, $user->role);
         unset($new_perms['options']);
         // don't need this for individual users
         $user->setAllPermissions($new_perms);
         $user->updatePermissions($h);
         $user->updateUserBasic($h);
         // set email valid to 1:
         $sql = "UPDATE " . TABLE_USERS . " SET user_email_valid = %d WHERE user_id = %d";
         $h->db->query($h->db->prepare($sql, 1, $user->id));
         // notify chosen mods of new user by email:
         if ($h->vars['useEmailNotify'] == 'checked' && file_exists(PLUGINS . 'users/libs/UserFunctions.php')) {
             require_once PLUGINS . 'users/libs/UserFunctions.php';
             $uf = new UserFunctions();
             $uf->notifyMods($h, 'user', $user->role, $user->id);
         }
         $success_message = $h->lang['user_signin_register_emailconf_success'] . " <br /><b><a href='" . $h->url(array('page' => 'login')) . "'>" . $h->lang['user_signin_register_emailconf_success_login'] . "</a></b>";
         $h->messages[$success_message] = 'green';
     } else {
         $h->messages[$h->lang['user_signin_register_emailconf_fail']] = 'red';
     }
     return true;
 }
开发者ID:shibuya246,项目名称:Hotaru-Plugins,代码行数:43,代码来源:user_signin.php


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