Giter Club home page Giter Club logo

verify's People

Contributors

dshoreman avatar edvinaskrucas avatar toddish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

verify's Issues

New user with existing Role

Hi there,

In de documentation I read the following:

// Create a new Permission
$permission = new \Verify\Models\Permission;
$permission->name = 'delete_user';
$permission->save();

// Create a new Role
$role = new Verify\Models\Role;
$role->name = 'Moderator';
$role->level = 7;
$role->save();

// Assign the Permission to the Role
$role->permissions()->sync(array($permission->id));

// Create a new User
$user = new \Verify\Models\User;
$user->username = 'Todd';
$user->email = '[email protected]';
$user->password = 'password'; // This is automatically salted and encrypted
$user->save();

// Assign the Role to the User
$user->roles()->sync(array($role->id));

I created the roles and the permissions, so that's that.
Now when I create a new user.. how would I assign a existing role and/or
permission?

I would think I need to do something like

$role = \Verify\Models\Role::where_level(1)->first();

This works, but I do not know if it is the right way to go.

Username or Email as Unique

It seems neither the Username or Email columns are unique, this can cause two accounts of the same username or email to be created. Not sure if this was intentional but I would suggest at least one or both of these fields be required to be unique.

Auth::is('Role name') always returns false for logged in user with that role.

Verify library assumes that you have checked for logged in user before using the role checking and returns false even if the user is logged in and has that role.

Example: I had a view that add's functionality based on role but visitor doesnt have to be logged in so there's no Auth::check(), Auth::guest() etc. used before using Auth::is('Role name') check.

I fixed this by adding the check to the private function get_user($user = NULL) method:

Replace this:

$user = $this->user;

..with this:

if ($this->check())
{
    $user = $this->user;
}
else
{
    $user = NULL;
}

With this the user gets initialized/populated if visitor is logged in.

updating user doesn't hash the password

My User model extends Verify\Models\User, and most everything is working awesome. Thanks for this bundle.

One issue I have is when I try to run an update on the user (i.e. changing the password) everything seems to work fine, but the password is not getting hashed or salted, it is just inserted as plain text.

User::where_id(Input::get('user_id'))
->update(array(
        'password'   => Input::get('password'),
    'updated_at' => date('Y-m-d g:i:s'),
));

Provide value for timestamps

Time columns can't be null:

    DB::table(VERIFY_PREFIX.'roles')->insert(array(
        'name'              => Config::get('verify::verify.super_admin'),
        'level'             => 10,
        'created_at'        => date('Y-m-d H:i:s'),
        'updated_at'        => date('Y-m-d H:i:s')
    ));

    DB::table(VERIFY_PREFIX.'users')->insert(array(
        'username'          => 'admin',
        'password'          => '$2a$08$rqN6idpy0FwezH72fQcdqunbJp7GJVm8j94atsTOqCeuNvc3PzH3m',
        'salt'              => 'a227383075861e775d0af6281ea05a49',
        'role_id'           => 1,
        'email'             => '[email protected]',
        'created_at'        => date('Y-m-d H:i:s'),
        'updated_at'        => date('Y-m-d H:i:s')
    ));

No outstanding migrations.

php artisan bundle:install verify
Successfully Installed!

php artisan migrate verify
string(58) "SELECT name FROM laravel_migrations WHERE bundle = ?"
No outstanding migrations.

The install script doesn't register the migration into the database.

General error: 1005 at artisan migrate verify

Just created a fresh and clean Laravel installation and installed the verify bundle.

However if i migrate verify the response is;

SQLSTATE[HY000]: General error: 1005 Can't create table 'mydb.#sql-3e3_e0' (errno: 150)
SQL: ALTER TABLE users ADD CONSTRAINT users_role_id_foreign FOREIGN KEY (role_id) REFERENCES roles (id)

My own migration work great, so i guess something is 'broken'?

Access model in models folder

Hi,

I am expanding the User class of Verify to make some changes for my project.
I want to access a model that I have, named Project.

Which namespace do I need to use? It's in the default application/models folder.

General error: 1 near "CONSTRAINT": syntax error when using sqlite

When running the migrate command in artisan, a sql error is thrown

ALTER TABLE "users" ADD CONSTRAINT users_role_id_foreign FOREIGN KEY ("role_id") REFERENCES "roles" ("id")

According to the SQLite docs, only RENAME TABLE and ADD COLUMN are supported for the ALTER TABLE command.

Column description should be nullable

Running the migrate command returns

$ php artisan migrate verify
SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "description" violates not-null constraint

SQL: INSERT INTO "roles" ("name", "level") VALUES (?, ?)

Bindings: array (
0 => 'Super Admin',
1 => 10,
)

Initial MySQL migration error

While installing in a blank MySQL database called 'demo' :

$ php artisan migrate verify
SQLSTATE[HY000]: General error: 1005 Can't create table 'demo.#sql-3bf_30' (errno: 150)

SQL: ALTER TABLE users ADD CONSTRAINT users_role_id_foreign FOREIGN KEY (role_id) REFERENCES roles (id)

Bindings: array (
)

got an error similar to the other issues

SQLSTATE[HY000]: General error: 1005 Can't create table 'verify-auth.#sql-920_4f
1' (errno: 150)

SQL: ALTER TABLE users ADD CONSTRAINT users_role_id_foreign FOREIGN KEY (role _id) REFERENCES roles (id)

Bindings: array (
)

Grab user with model

Hi,

I have a model, and I have this function:

<?php
class Ticketentry extends Eloquent {
    public function ticket()
    {
        return $this->has_one('Ticket');
    }

    public function user()
    {
        return $this->has_one('Verify\Models\User','id');
    }
}

Yet, when I grab a Ticketentry, and I try to do $ticketentry->user->username, it doesn't work. What am I doing wrong?

I get this error:

Trying to get property of non-object

Example

Hello!
Give please a form view and controler example for work with Verify.
Thanks!

Usage in task

Hi,

How do i use Verify in a task? Verify\Models\User::where(args) doesnt work, because it couldnt find the class.

Prefix for db tables

@Toddish A feature request:

Could there be some sort of config setting added that would allow to prefix the db_tables?

On a big project it would make it clearer which tables are from what.

General error: 1 near "CONSTRAINT": syntax error

Installing on a blank sqlite3 database....

$ php artisan migrate verify
SQLSTATE[HY000]: General error: 1 near "CONSTRAINT": syntax error

SQL: ALTER TABLE "users" ADD CONSTRAINT users_role_id_foreign FOREIGN KEY ("role
_id") REFERENCES "roles" ("id")

Bindings: array (
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.