[color="#2E8B57"]/* NOTE : Please do not post duplicated posts in different forums. The same topic of yours in Extension forum will be deleted. */[/color]
It’s a common requirement to allow the deleting and editing of a post (or a note, in your case) only to the author of it (and also to the administrators of the system).
But, as a matter of fact, it’s not so easy to implement as you might think. It’s one of the most difficult parts of a web application in general. This is not only true with Yii, but also with every framework in the world.
The extensions like yii-user may somewhat make it easier to implement it, but you will definitely need to know the auth mechanism of Yii as the basis.
Did you walk through the "Blog Tutorial", BUILDING A BLOG SYSTEM USING YII?
You can learn the basic authentication and authorization in Authenticating User section of it.
but it’s just missing this part and I don’t know anyone to help me. I don’t have too much money because I’m working in this project by my self but would you be able to help me doing this? I’m willing to pay depending in how much you charge because I already read a lot of tutorials and I’ve been staying up all night for the past weeks just because of that.
Or if you are not able to help me, do you know someone that can?
Wow, the demo looks nice. I like this kind of simpleness.
About your proposal on a business relation, I have to say sorry that I can’t do it.
You may try to find a partner using “Job Opportunities” forum … although I’m a little skeptical about the possibility of finding a good partner, you may try it anyway.
This will be the possible milestones of your project.
Integrate yii-user module
If you have not integrated yii-user yet, you should do it first.
When you have trouble, you can search and ask it in "Extensions" forum.
Modify model
Modify your Note model to record the author ID when a note is created.
Modify controller
Modify the controller to allow the access to ‘view’, ‘update’ and ‘delete’ actions only to the authorized users, i.e., the author of the requested note or the superuser.
You may allow the ‘view’ action to every logged-in user, or even to the guests. It depends on your design.
You can do it basically by comparing the current user ID and the author ID of the requested note.
Every unauthorized access should result in CHttpException, like 401 or 404.
Modify views
Your view should not show the links to update or delete the notes that are not allowed to the current user. You don’t want to see the links or buttons that will only lead you to an error page that says “You are not authorized …”.
It means that you have to dynamically modify the output of the items in a list, for example.
This is also done basically by comparing the current user ID and the author ID of the note.
Note that implementing 4) doesn’t cancel the necessity of implementing 3).
But don’t even try to register because I disabled some stuffs. It’s just for test.
Everything that you said makes sense but as I’m on my own this time I already posted on Elance to find some help and I found someone but thanks for the teaching. As soon I release this project I will send you a link