本文整理汇总了PHP中Sentry类的典型用法代码示例。如果您正苦于以下问题:PHP Sentry类的具体用法?PHP Sentry怎么用?PHP Sentry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sentry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Check_User_Cart
function Check_User_Cart()
{
$Identifier = '';
if (!Sentry::check()) {
return false;
} else {
$Identifier = Sentry::user()->id;
if (Cookie::has('Anon_Cart_Extension')) {
$AnonIdentifier = Cookie::get('Anon_Cart_Extension');
$dataAnon = Cache::get('user_cart.' . $AnonIdentifier);
if (Cache::has('user_cart.' . $Identifier)) {
$dataUser = Cache::get('user_cart.' . $Identifier);
if ($dataAnon != null && $dataUser != null) {
foreach ($dataAnon as $key => $value) {
if (!isset($dataUser[$key])) {
$dataUser[$key] = $value;
}
}
Cache::forever('user_cart.' . $Identifier, $dataUser);
Cache::forget('user_cart.' . $AnonIdentifier);
}
} else {
if ($dataAnon != null) {
Cache::forever('user_cart.' . $Identifier, $dataAnon);
Cache::forget('user_cart.' . $AnonIdentifier);
}
}
}
}
}
开发者ID:TahsinGokalp,项目名称:L3-Eticaret,代码行数:30,代码来源:helpers.php
示例2: run
public function run()
{
DB::table('users')->delete();
DB::table('groups')->delete();
DB::table('users_groups')->delete();
Sentry::getUserProvider()->create(array('email' => '[email protected]', 'password' => "admin", 'first_name' => 'admin', 'last_name' => 'admin', 'activated' => 1));
Sentry::getGroupProvider()->create(array('name' => 'Super Admin', 'permissions' => array('admin' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Office Admin', 'permissions' => array('admin' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Project Manager', 'permissions' => array('admin' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Team Leader', 'permissions' => array('admin' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Developer', 'permissions' => array('admin' => 1)));
Sentry::getUserProvider()->create(array('email' => '[email protected]', 'password' => "admin", 'first_name' => 'Ashok', 'last_name' => 'Adhikari', 'activated' => 1));
Sentry::getUserProvider()->create(array('email' => '[email protected]', 'password' => "santosh", 'first_name' => 'Santosh', 'last_name' => 'Dhungana', 'activated' => 1));
Sentry::getUserProvider()->create(array('email' => '[email protected]', 'password' => "dinesh", 'first_name' => 'Dinesh', 'last_name' => 'Sharma', 'activated' => 1));
Sentry::getUserProvider()->create(array('email' => '[email protected]', 'password' => "asheem", 'first_name' => 'Asheem', 'last_name' => 'Manandhar', 'activated' => 1));
// Assign user permissions
$adminUser = Sentry::getUserProvider()->findByLogin('[email protected]');
$adminGroup = Sentry::getGroupProvider()->findByName('Super Admin');
$adminUser->addGroup($adminGroup);
$adminUser = Sentry::getUserProvider()->findByLogin('[email protected]');
$adminGroup = Sentry::getGroupProvider()->findByName('Office Admin');
$adminUser->addGroup($adminGroup);
$adminUser = Sentry::getUserProvider()->findByLogin('[email protected]');
$adminGroup = Sentry::getGroupProvider()->findByName('Project Manager');
$adminUser->addGroup($adminGroup);
$adminUser = Sentry::getUserProvider()->findByLogin('[email protected]');
$adminGroup = Sentry::getGroupProvider()->findByName('Team Leader');
$adminUser->addGroup($adminGroup);
$adminUser = Sentry::getUserProvider()->findByLogin('[email protected]');
$adminGroup = Sentry::getGroupProvider()->findByName('Developer');
$adminUser->addGroup($adminGroup);
}
开发者ID:arikazukitomaharjan,项目名称:OfficeSystem,代码行数:32,代码来源:SentrySeeder.php
示例3: assessmentupdateget
public function assessmentupdateget($dash, $id)
{
$assessment = Assessments::find($id);
$user = User::find($assessment->teacherid);
if (Sentry::getUser()->id == $user->id) {
$theme = Theme::uses('dashboard')->layout('default');
$view = array('name' => 'Dashboard Assessment Update', 'id' => $id);
$theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Assessments', 'url' => Setting::get('system.dashurl') . '/assessments'], ['label' => $id, 'url' => Setting::get('system.dashurl') . '/assessment/' . $id]]);
$theme->appendTitle(' - Assessment Update');
$theme->asset()->container('datatable')->writeScript('inline-script', '$(document).ready(function(){
$(\'#attachments\').dataTable({
"sDom": "<\'row\'<\'col-xs-5 col-sm-5 col-md-5\'l><\'col-xs-5 col-sm-5 col-md-5\'f>r>t<\'row\'<\'col-xs-5 col-sm-5 col-md-5\'i><\'col-xs-5 col-sm-5 col-md-5\'p>>",
"oLanguage": {
"sLengthMenu": "_MENU_ ' . ' Attachments per page"
},
"sPagination":"bootstrap"
});
});$(document).ready(function(){
$(\'#questionfail\').dataTable({
"sDom": "<\'row\'<\'col-xs-5 col-sm-5 col-md-5\'l><\'col-xs-5 col-sm-5 col-md-5\'f>r>t<\'row\'<\'col-xs-5 col-sm-5 col-md-5\'i><\'col-xs-5 col-sm-5 col-md-5\'p>>",
"oLanguage": {
"sLengthMenu": "_MENU_ ' . ' Failures per page"
},
"sPagination":"bootstrap"
});
});');
$theme->asset()->container('footer')->writeScript('inline-script', '$(document).ready(function(){
$("#examsheader").hide();
$("div#exams").hide();
$("div#examslock").hide();
$(".hidequestions").hide();
$(".hidequestions").click(function(){
$("div#exams").hide(2000);
$(\'html, body\').animate({
scrollTop: $("#top").offset().top
}, 2000);
$("#examsheader").hide(1200);
$("#examslock").hide(1200);
$(".hidequestions").hide(1000);
$("#showquestions").show(1000);
});
$("#showquestions").click(function(){
$("div#exams").show(2000);
$("div#examslock").show(100);
$(\'html, body\').animate({
scrollTop: $("#examslock").offset().top
}, 2000);
$("#examsheader").show(1000);
$(".hidequestions").show(1000);
$("#showquestions").hide(1000);
});
});');
return $theme->scope('assessment.update', $view)->render();
// return View::make('dashboard.assessments.update')->with('id',$id);
} else {
return "UPDATE NOT AUTHORISED";
}
}
开发者ID:eufelipemartins,项目名称:edlara,代码行数:60,代码来源:HttpController.php
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('groups')->delete();
Sentry::getGroupProvider()->create(array('name' => 'Users', 'permissions' => array('admin.users' => 0, 'user.interface' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Admins', 'permissions' => array('admin.users' => 1, 'user.interface' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'EmfUsers', 'permissions' => array('admin.users' => 0, 'user.interface' => 1, 'emf.login' => 1)));
}
开发者ID:jinxiao8942,项目名称:laravel-kuu,代码行数:12,代码来源:SentryGroupSeeder.php
示例5: canEdit
public static function canEdit($id)
{
if (Sentry::check() && (Sentry::getUser()->id == $id || Sentry::getUser()->isSuperUser())) {
return true;
}
return false;
}
开发者ID:shaikhatik0786,项目名称:Masteranime,代码行数:7,代码来源:UserList.php
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('groups')->delete();
Sentry::getGroupProvider()->create(array('name' => 'Users'));
Sentry::getGroupProvider()->create(array('name' => 'Admins'));
Sentry::getGroupProvider()->create(array('name' => 'Subscribers'));
}
开发者ID:ArbindJain,项目名称:scrapkart,代码行数:12,代码来源:SentryGroupSeeder.php
示例7: insert_users
protected function insert_users()
{
for ($i = 0; $i != 20; ++$i) {
$password = $this->get_random(self::$RANDOM_ALPHA_NUM, 6, 16);
Sentry::createUser(['password' => $password, 'nickname' => $this->get_random(self::$RANDOM_ALPHA, 4, 12), 'real_name' => $this->get_random(self::$RANDOM_ALPHA, 4, 12), 'phone' => rand(0, count(self::$TELEPHONE_PREFIX)) + $this->get_random(self::$RANDOM_NUM, 8, 8), 'account' => $this->get_random(self::$RANDOM_ALPHA_NUM, 6, 16), 'role' => 1, 'gender' => rand(0, 1), 'activated' => 1]);
}
}
开发者ID:Jv-Juven,项目名称:hospital-register-system,代码行数:7,代码来源:InsertTestDataCommand.php
示例8: getProdlist
public function getProdlist()
{
$user = Sentry::getUser()->id;
// $content = View::make('backend.widgets.prodlist');
// return View::make('backend.general', compact('content'));
return View::make('backend.widgets.prodlist');
}
开发者ID:chris27tina,项目名称:TODO,代码行数:7,代码来源:TestController.php
示例9: pushMessage
public function pushMessage()
{
if (!Sentry::check()) {
return Response::json(array('errCode' => 10, 'message' => '请登录'));
}
Sentry::login(Sentry::findUserById(5), false);
$user = Sentry::getUser();
// $user = User::find(1);
$push_status = PushStatus::where('user_id', $user->id)->first();
if (count($push_status) == 0) {
$push_status = new PushStatus();
$push_status->user_id = $user->id;
$push_status->status = 1;
if (!$push_status->save()) {
return Response::json(array('errCode' => 1, 'message' => '[数据库错误]开启消息推送失败'));
}
return Response::json(array('errCode' => 0, 'message' => '开启消息推送'));
}
if ($push_status->status == 1) {
$push_status->status = 0;
if (!$push_status->save()) {
return Response::json(array('errCode' => 2, 'message' => '[数据库错误]开启消息推送失败'));
}
return Response::json(array('errCode' => 0, 'message' => '开启消息推送'));
}
if ($push_status->status == 0) {
$push_status->status = 1;
if (!$push_status->save()) {
return Response::json(array('errCode' => 3, 'message' => '[数据库错误]开启消息推送失败'));
}
return Response::json(array('errCode' => 0, 'message' => '开启消息推送'));
}
}
开发者ID:Jv-Juven,项目名称:gift,代码行数:33,代码来源:SiteController.php
示例10: update_post
public function update_post($id)
{
$this->_exists($id);
$rules = User::get_rules($id);
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
// Find the user using the user id
$user = Sentry::findUserById($id);
$user->first_name = Input::get('first_name');
$user->last_name = Input::get('last_name');
$user->tin_number = Input::get('tin_number');
$user->landline = Input::get('landline');
$user->mobile = Input::get('mobile');
$user->work_address = json_endcode(explode(",", Input::get('work_address')));
$user->home_address = json_endcode(explode(",", Input::get('home_address')));
$user->company = Input::get('company');
$user->occupation = Input::get('occupation');
$user->email = Input::get('email');
if (Input::get('password')) {
$user->password = Input::get('password');
}
if (Input::get('activated') == 1) {
$user->activated = true;
} else {
$user->activated = false;
}
$user->save();
return Redirect::to('admin/clients')->with('success', 'Client account has been successfully updated.');
}
return Redirect::to('admin/clients/update/' . $id)->withErrors($validator)->withInput();
}
开发者ID:jacobDaeHyung,项目名称:Laravel-Real-Estate-Manager,代码行数:31,代码来源:ClientsController.php
示例11: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (\Sentry::check()) {
return new RedirectResponse(url('/'));
}
return $next($request);
}
开发者ID:rafaelvieiras,项目名称:connect,代码行数:14,代码来源:RedirectIfAuthenticated.php
示例12: postRegistro
public function postRegistro()
{
$input = Input::all();
$reglas = array('nombre' => 'required', 'apellido' => 'required', 'celular' => 'required|numeric|unique:users', 'cedula' => 'required|numeric|unique:users', 'email' => 'required|email|unique:users', 'pin' => 'required|numeric|digits_between:0,4', 'password' => 'required|numbers|case_diff|letters|min:6|confirmed', 'password_confirmation' => 'required|min:6');
$validation = Validator::make($input, $reglas);
if ($validation->fails()) {
return Response::json(['success' => false, 'errors' => $validation->errors()->toArray()]);
}
try {
// se guarda los datos del usuario
$user = Sentry::register(array('first_name' => Input::get('nombre'), 'last_name' => Input::get('apellido'), 'email' => Input::get('email'), 'habilitar_pin' => 1, 'celular' => Input::get('celular'), 'cedula' => Input::get('cedula'), 'password' => Input::get('password'), 'pin' => Input::get('pin'), 'porcentaje' => 0.05, 'activated' => true));
$userId = $user->getId();
$token = new Token();
$token->user_id = $userId;
$token->api_token = hash('sha256', Str::random(10), false);
$token->client = BrowserDetect::toString();
$token->expires_on = Carbon::now()->addMonth()->toDateTimeString();
$token->save();
// Se autentica de una
$user_login = Sentry::findUserById($userId);
Sentry::login($user_login, false);
return Response::json(['success' => true, 'user' => $user_login, 'token' => $token->api_token]);
} catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
$error = array('usuario' => 'Email es requerido');
} catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
$error = array('usuario' => 'Password es requerido');
} catch (Cartalyst\Sentry\Users\UserExistsException $e) {
$error = array('usuario' => 'El Email ya está registrado');
}
return Response::json(['success' => false, 'errors' => $error]);
}
开发者ID:riverajefer,项目名称:bcserver,代码行数:31,代码来源:AuthController.php
示例13: postCreate
/**
* Blog post create form processing.
*
* @return Redirect
*/
public function postCreate()
{
// Declare the rules for the form validation
$rules = array('title' => 'required|min:3', 'content' => 'required|min:3');
// Validate the inputs
$validator = Validator::make(Input::all(), $rules);
// Check if the form validates with success
if ($validator->passes()) {
// Create a new blog post
$post = new Post();
// Update the blog post data
$post->title = Input::get('title');
$post->slug = convert_to_slug(Input::get('title'));
$post->content = Input::get('content');
$post->meta_title = Input::get('meta-title');
$post->meta_description = Input::get('meta-description');
$post->meta_keywords = Input::get('meta-keywords');
$post->user_id = Sentry::getId();
// Was the blog post created?
if ($post->save()) {
// Redirect to the new blog post page
return Redirect::to('admin/blogs/' . $post->id . '/edit')->with('success', Lang::get('admin/blogs/messages.create.success'));
}
// Redirect to the blog post create page
return Redirect::to('admin/blogs/create')->with('error', Lang::get('admin/blogs/messages.create.error'));
}
// Form validation failed
return Redirect::to('admin/blogs/create')->withInput()->withErrors($validator);
}
开发者ID:nozkok,项目名称:laravel-4-starter,代码行数:34,代码来源:AdminBlogsController.php
示例14: resetAction
public function resetAction()
{
// Fetch all request data.
$data = Input::only('email', 'password', 'password_confirmation', 'pass_code');
// Build the validation constraint set.
$rules = array('email' => array('required'), 'password' => array('required', 'confirmed', 'min:5'));
$validator = Validator::make($data, $rules);
if ($validator->passes()) {
$user = Sentry::findUserByLogin(Input::get('email'));
// Check if the reset password code is valid
if ($user->checkResetPasswordCode(Input::get('pass_code'))) {
// Attempt to reset the user password
if ($user->attemptResetPassword(Input::get('pass_code'), Input::get('password'))) {
$user->reset_password_code = '';
$user->save();
return Redirect::to('/login')->with('global_success', 'Password has been set. You can now sign in with your new password.');
} else {
return Redirect::to('/reset')->with('global_error', 'System couldn\'t change your password. Please try again and if situation repeats, report to support.');
}
} else {
return Redirect::to('/request')->with('global_error', 'Your reset code doesn\'t match. It may be corrupted or outdated. Please make a new request.');
}
}
return Redirect::to('/reset/' . Input::get('pass_code'))->withErrors($validator)->with('message', 'Validation Errors!');
}
开发者ID:Belar,项目名称:librific,代码行数:25,代码来源:AuthController.php
示例15: __construct
public function __construct()
{
if (Sentry::check()) {
// User is not logged in, or is not activated
$this->data['admin'] = Sentry::getUser();
}
}
开发者ID:jacobDaeHyung,项目名称:PHPLaravelGymManagementSystem,代码行数:7,代码来源:BaseController.php
示例16: getLogout
public function getLogout()
{
if (Sentry::check()) {
Sentry::logout();
return Redirect::route('index');
}
}
开发者ID:minnb,项目名称:vitduct,代码行数:7,代码来源:AuthController.php
示例17: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
// var_dump(Input::All());
// die;
//
// 'categorias_id' => 'exists:rubros,id'
$rules = ['articulo' => 'required', 'copete' => 'required', 'texto' => 'required'];
if (!Articulo::isValid(Input::all(), $rules)) {
return Redirect::back()->withInput()->withErrors(Articulo::$errors);
}
$articulo = new Articulo();
$articulo->users_id = Sentry::getUser()->id;
$articulo->articulo = Input::get('articulo');
$articulo->copete = Input::get('copete');
$articulo->texto = Input::get('texto');
$articulo->tipo = Input::get('tipo');
$articulo->categorias_id = Input::get('categorias_id');
$url_seo = Input::get('articulo');
$articulo->estado = 'nuevo';
//$url_seo = $this->url_slug($url_seo) . implode("-",getdate());
$url_seo = $this->url_slug($url_seo) . date('ljSFY');
$articulo->url_seo = $url_seo;
$articulo->save();
return Redirect::to('/articulos/ver');
}
开发者ID:keloxers,项目名称:Cooperativa,代码行数:30,代码来源:ClasificadoscategoriasController.php
示例18: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('users')->delete();
Sentry::getUserProvider()->create(['email' => '[email protected]', 'password' => '12345678', 'first_name' => 'Administrador', 'last_name' => 'Kentron', 'activated' => 1]);
Sentry::getUserProvider()->create(['email' => '[email protected]', 'password' => '12345678', 'first_name' => 'Invitado', 'last_name' => 'Kentron', 'activated' => 1]);
$this->command->info('Users seeded!');
}
开发者ID:kentronvzla,项目名称:webkentron,代码行数:12,代码来源:SentryUserSeeder.php
示例19: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$admins = Sentry::getGroupProvider()->findByName('Admins');
$diff = array_diff($this->permissions, $admins->permissions);
$admins->permissions = $diff;
$admins->save();
}
开发者ID:abhijo89,项目名称:VMPanel,代码行数:12,代码来源:2013_07_02_203016_adding_plan_permissions.php
示例20: run
public function run()
{
DB::table('users_groups')->delete();
DB::table('groups')->delete();
DB::table('users')->delete();
DB::table('throttle')->delete();
try {
$group = Sentry::createGroup(array('name' => 'administrator', 'description' => 'Administrator', 'permissions' => array('admin' => 1)));
$group = Sentry::createGroup(array('name' => 'operator', 'description' => 'Operator', 'permissions' => array('operator' => 1)));
} catch (Cartalyst\Sentry\Groups\NameRequiredException $e) {
echo "Name file is Required";
} catch (Cartalyst\Sentry\Groups\GroupExistsException $e) {
echo "Group already exists";
}
try {
$admin = Sentry::register(array('email' => '[email protected]', 'password' => 'admin', 'first_name' => 'Administrator', 'last_name' => 'IT KSA'), true);
$adminGroup = Sentry::findGroupByName('administrator');
$admin->addGroup($adminGroup);
$operator = Sentry::register(array('email' => '[email protected]', 'password' => '090996o9o9g6!@#', 'first_name' => 'Operator', 'last_name' => 'IT KSA'), true);
$operatorGroup = Sentry::findGroupByName('operator');
$operator->addGroup($operatorGroup);
} catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
echo "Login field is required";
} catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
echo "Password field is required";
} catch (Cartalyst\Sentry\Users\UserExistsException $e) {
echo "User with this login is Required";
} catch (Cartalyst\Sentry\Users\GroupNotFoundException $e) {
echo "Group was not found";
}
}
开发者ID:antoniosai,项目名称:daily-activity-management,代码行数:31,代码来源:SentrySeeder.php
注:本文中的Sentry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论