bestmomo / laravel5-example

Simple laravel5 example for tutorial
MIT License
1.2k stars 568 forks source link

Want to Edit Role Permission #71

Open commanderinchief opened 8 years ago

commanderinchief commented 8 years ago

Redactor accounts can't either edit post or publish. I do like to give Redactors to those permission. How to fix the role permission? Please teach me Sir.

bestmomo commented 8 years ago

Hello

Why do you say redactors cant manage posts (dreate, edit, publish) ? They can ! But only their posts with their medias. Try redac@la.fr account (with redac password).

Regards

commanderinchief commented 8 years ago

In localhost Redactors is working properly. But Not Working and shown "This Action is Unauthorized" message at my web hosting.

bestmomo commented 8 years ago

Are you sure sessions are working fine on your production server ?

commanderinchief commented 8 years ago

I'm not sure session is working fine. I don't know how to check and fix. Please teach me Sir.

bestmomo commented 8 years ago

Make sure your server meets the following requirements:

PHP >= 5.5.9
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension

Is authentication working ?

commanderinchief commented 8 years ago

My Server is running with PHP 5.6 and Extension are installed as following Pic. What I need to do now? php

commanderinchief commented 8 years ago

Error Message is here. error2

bestmomo commented 8 years ago

I cant see the OpenSSL PHP Extension but I dont think this is related.

Authorization is set in app/Policies/PostPolicy.php :

public function change(User $user, Post $post)
{
    return $user->id === $post->user_id;
}

There we check if authenticated user is post owner.

You should debug there to know what happens.

commanderinchief commented 8 years ago

I see this file and code is same as you shown. How to do? I don't know. May be something wrong with Webhost. Localhost is OK.

bestmomo commented 8 years ago

Dump the variables :

dd($user->id);

And

dd($post->user_id);

You should have the same value there.

commanderinchief commented 8 years ago

It's shown number 6 and post owner ID also 6.

bestmomo commented 8 years ago

So I dont understand your error 403...

commanderinchief commented 8 years ago

May be something is mising in Webhost server or Role Permission need to fix. I don't know how to fix it. And How to rewrite role permissions?