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


PHP Groups::addGroup方法代码示例

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


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

示例1: altSubValue

        }
        break;
    case 'save':
        $type = altSubValue($_POST, 'type', '');
        $id = altSubValue($_POST, 'id', '');
        $show_action = altSubValue($_POST, 'show_action', '');
        //TODO do some checks here
        if (!isValidOrganisationType($type)) {
            //&& ($type !== _PROJECT_OBJ)
            $result = NULL;
            drupal_set_message(tt('This is not a valid type: %s', $type), 'error');
            echo jsonBadResult();
            return;
        }
        $properties = Groups::filterPostByType($type, $_POST);
        if (!$id) {
            $new = true;
            $result = $type == _STUDENT_GROUP ? Groups::addStudentGroup($properties) : ($type == _PROJECT_OBJ ? Project::getInstance()->addProject($properties) : Groups::addGroup($properties, $type));
        } else {
            $new = false;
            $result = Groups::changeGroup($type, $properties, $id);
        }
        if ($result) {
            echo json_encode(array('result' => TRUE, 'id' => $id, 'type' => $type, 'new_tab' => !$id ? $result : 0, 'show_action' => $show_action, 'msg' => ($id ? tt('You succesfully changed the data of your %1$s', t_type($type)) : tt('You succesfully added your %1$s', t_type($type))) . (_DEBUG ? showDrupalMessages() : '')));
        } else {
            echo jsonBadResult();
        }
        break;
    default:
        echo "No such action: " . $_GET['action'];
}
开发者ID:edwinraycom,项目名称:vals-soc,代码行数:31,代码来源:administration_actions.php

示例2: createAdminAccount

 /**
  * Crear el usuario admin de sysPass.
  * Esta función crea el grupo, perfil y usuario 'admin' para utilizar sysPass.
  *
  * @throws SPException
  */
 private static function createAdminAccount()
 {
     // Datos del grupo
     Groups::$groupName = "Admins";
     Groups::$groupDescription = "Admins";
     if (!Groups::addGroup()) {
         self::rollback();
         throw new SPException(SPException::SP_CRITICAL, _('Error al crear el grupo "admin"'), _('Informe al desarrollador'));
     }
     $User = new User();
     // Establecer el id de grupo del usuario al recién creado
     $User->setUserGroupId(Groups::$queryLastId);
     $Profile = new Profile();
     $Profile->setName('Admin');
     $Profile->setAccAdd(true);
     $Profile->setAccView(true);
     $Profile->setAccViewPass(true);
     $Profile->setAccViewHistory(true);
     $Profile->setAccEdit(true);
     $Profile->setAccEditPass(true);
     $Profile->setAccDelete(true);
     $Profile->setConfigGeneral(true);
     $Profile->setConfigEncryption(true);
     $Profile->setConfigBackup(true);
     $Profile->setMgmCategories(true);
     $Profile->setMgmCustomers(true);
     $Profile->setMgmUsers(true);
     $Profile->setMgmGroups(true);
     $Profile->setMgmProfiles(true);
     $Profile->setEvl(true);
     if (!$Profile->profileAdd()) {
         self::rollback();
         throw new SPException(SPException::SP_CRITICAL, _('Error al crear el perfil "admin"'), _('Informe al desarrollador'));
     }
     // Datos del usuario
     $User->setUserLogin(self::$_username);
     $User->setUserPass(self::$_password);
     $User->setUserName('Admin');
     $User->setUserProfileId($Profile->getId());
     $User->setUserIsAdminApp(true);
     $User->setUserIsAdminAcc(false);
     $User->setUserIsDisabled(false);
     if (!$User->addUser()) {
         self::rollback();
         throw new SPException(SPException::SP_CRITICAL, _('Error al crear el usuario "admin"'), _('Informe al desarrollador'));
     }
     // Guardar el hash de la clave maestra
     ConfigDB::setCacheConfigValue('masterPwd', Crypt::mkHashPassword(self::$_masterPassword));
     ConfigDB::setCacheConfigValue('lastupdatempass', time());
     ConfigDB::writeConfig(true);
     if (!$User->updateUserMPass(self::$_masterPassword)) {
         self::rollback();
         throw new SPException(SPException::SP_CRITICAL, _('Error al actualizar la clave maestra del usuario "admin"'), _('Informe al desarrollador'));
     }
 }
开发者ID:bitking,项目名称:sysPass,代码行数:61,代码来源:Installer.class.php


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