I just want agent's username and password inside users table to make sure agents can login. Anyway, i try it first.
Thanks.
nOLL.
On Fri, Aug 19, 2011 at 12:05 PM, Zaky Katalan-Ezra <procsharp@gmail.com> wrote:
Every one how need to login to the application is a user, there for need to be saved in the users table.--
If you save additional attribute about a specific user it should be in a different table.
When you want admins you call select * from users where is_admin = 1;
And when you want agents you call select * from users where role = 'agent' and join it with the agents table.
What is the problem with mixing users in the same table?On Fri, Aug 19, 2011 at 3:59 AM, Mohd Hasnol <hasnolmohd@gmail.com> wrote:
Hi zaky,
Thanks for the response. actually i dont face a problem with authentication.The problem is when the admin fill in agents details including username and password, where should it be save? is it in agent table or user table(for admin). Since when login, it will recall username and password inside user's table and not agent's table. As i mention before, i plan not to mix admin details and agent details.
I already insert user_id inside agent table but still does'nt work. I already create for user and group and it work.
Thanks.
nOLLOn Thu, Aug 18, 2011 at 6:00 PM, Zaky Katalan-Ezra <procsharp@gmail.com> wrote:
Add a role column to the user info for role based access.
I suggest using cakedc users plugin.
When creating a new user you can specify a role.
I use this code in /cotroller/users/login
if ($this->Auth->user()) {
if($this->Auth->user('is_admin') == 1) {
$this->Auth->redirect('/admin/users/users/dashboard');
} else if ($this->Auth->user('role') == 'agent') {
$this->Auth->redirect('/agent/users/users/dashboard');
}else {
$this->Auth->redirect('/users/users/dashboard');
}
}On Thu, Aug 18, 2011 at 12:14 PM, Mohd Hasnol <hasnolmohd@gmail.com> wrote:
Hi zaky,
i already create agent table with user_id reference. But, i still cannot login as agent, since my login function will recall username and password in users table. There is no agent's info in the users table. Correct me if i got wrong concept.
Thanks.
nOLL.On Thu, Aug 18, 2011 at 10:45 AM, Zaky Katalan-Ezra <procsharp@gmail.com> wrote:
--Use users plugin.
Create an agent table with the additional attribute and user_id to reference the user.
Make /users/register visible to admin only.
After successful new user registration if the user role is agent, redirect to /admin/agent/add.
If you choose to implement role based access you can check the user role in login function and redirect the user with the right prefix.On Thu, Aug 18, 2011 at 4:22 AM, Mohd Hasnol <hasnolmohd@gmail.com> wrote:
Thanks.But how the agent would like to login since admin and agents use same login page. i use users table for login function. how i can link agent table to the login function? for my case,at first, admin will decide agents username and password. Then,admin will give it to the agents and they could change their password.
Thanks.On Wed, Aug 17, 2011 at 5:21 PM, WebbedIT <paul@webbedit.co.uk> wrote:ACL has little to do with this as your simply talking about which
model to use when creating an Agent, which has more field than a
standard User.
There is no right answer and you have a choice of using either /users/
agentAdd(agentEdit) or /agents/add(edit).
I personally prefer to keep my add and edit actions within their
respective controllers so would use the Agent model and include the
required User fields in the form. As long as you use $this->Agent-
>saveAll(); cake will deal with associating the two records for you.
HTH, Paul.
On Aug 16, 5:28 am, Mohd Hasnol <hasnolm...@gmail.com> wrote:
> FYI, Im using ACL for this case.
>
>
>
>
>
>
>
> On Tue, Aug 16, 2011 at 12:26 PM, nOLL <hasnolm...@gmail.com> wrote:> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > Hi,
>
> > Let say, I'm admin and i would like to add agents but i would like to
> > use different model (not users model). For example, agents model. the
> > reason i use different model because there is other attributes i would
> > like to fill in rather than username and password in users model. What
> > is the best solution for this?
>
> > Thanks.
> > nOLL
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > others with their CakePHP related questions.> > athttp://groups.google.com/group/cake-php
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
--Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
--Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
--Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
--Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
--
Regards,
Zaky Katalan-Ezra
QA Administrator
www.IGeneriX.com
Sites.IGeneriX.com
054-7762312
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment