Ok, tackled it.

so first i opened up my app/config/bootstrap file and put this at the
bottom:

define('ADMIN_DIR', ROOT . DS . 'admin');
define('SETTINGS_CACHE_FILE', TMP . 'settings' . DS . 'cache');

$modelPaths = array(ADMIN_DIR . DS . 'models' . DS);
$viewPaths = array(ADMIN_DIR . DS . 'views' . DS);
$controllerPaths = array(ADMIN_DIR . DS . 'controllers' . DS);
$behaviorPaths = array(ADMIN_DIR . DS . 'models' . DS . 'behaviors' .
DS);
$helperPaths = array(ADMIN_DIR . DS . 'views' . DS . 'helpers' . DS);
$componentPaths = array(ADMIN_DIR . DS . 'controllers' . DS .
'components' . DS);

in short i have a global where my admin dir is and then below it i
tell cake where to find __additional__ models

now however we have the problem of users freely getting access to the
admin and we can't have that now can we ;)

so open app/app_controller.php ( create it if it doesnt exist ), and
put in:

class AppController extends Controller
        {
                var $helpers = array('javascript', 'form', 'html', 'session',
'Ajax', 'Text');
                var $components = array('RequestHandler', 'Cookie', 'Auth',
'Imagetoolbox');

        var $uses = array('User');

        function beforeFilter()
        {
            Security::setHash('md5');

            $this->Auth->loginAction    = array('controller' =>
'users', 'action' => 'login');
            $this->Auth->loginRedirect  = array('controller' =>
'screens', 'action' => 'dashboard');
            $this->Auth->logoutRedirect = array('controller' =>
'users', 'action' => 'login');
            $this->Auth->loginError     = 'Wrong username / password
combination';
            $this->Auth->authError      = 'You must be logged in
before you can access the admin';
            $this->Auth->authorize      = 'controller';
            $this->Auth->autoRedirect   = false;

            $cookie = $this->Cookie->read('User');

            if (is_array($cookie) && !$this->Auth->user())
            {
                if ($this->User->checkLogin($cookie['username'],
$cookie['token']))
                {
                    if (!$this->Auth->login($this->User))
                    {
                    $this->Cookie->del('User');
                    }
                }
            }

            $this->layout = 'admin';
        }
    }

check up on the auth component for the usage, but remember that it
expects your login in the db to be called username
and the password to be called password. It autohashes passwords for
you when you add, edit, etc data.

now for every controllet that you have put this at the top:

function isAuthorized()
        {
            return true;
        }

        function beforeFilter()
        {
            $this->Auth->allow('index', 'preview');
            parent::beforeFilter();
        }

the isauthorized function ( true false ) means that the whole
controller needs to be authed or not ( for example your
controllers that server purely views should have this on false ).

The other function says which functions are allowed without
authorisation. you can also say $this->Auth->deny('functionname');
to say which functions do need authorisation.

Hope this clarifies things a bit. if you need more explanation, be
free to ask :)

On 15 okt, 03:19, Shackadoodl <[EMAIL PROTECTED]> wrote:
> I just went to sleep, but i couldnt sleep untill i fixed the bug, so
> now im back.
>
> The way im solving it now is with the bootstrap file indeed. I include
> the admin models, views,
> controllers etc into the normal app remotely, and everything seems to
> work. The only crap that
> im facing now is the auth component.
>
> When everything is fixed i will reply with a little howto for future
> reference.
>
> Could you also post your fix, i might learn something from it.
>
> Grtz shacka
>
> On Oct 15, 3:14 am, hydra12 <[EMAIL PROTECTED]> wrote:
>
> > I don't have access to my dev machine right now to check, but I think
> > you can do this in the bootstrap file.  I'll see if I can find more
> > tomorrow.
>
> > On Oct 14, 6:14 pm, Shackadoodl <[EMAIL PROTECTED]> wrote:
>
> > > Hi guys,
>
> > > Urgent question:
>
> > > I have a project with an extremely tight deadline, so rebuilding it
> > > all is out of the question.
>
> > > The problem is, that i have developped a cms ( which works just fine )
> > > next to the app folder. The structure looks like this
>
> > > -root
> > > --app
> > > --cms -> just a renamed copy off the app folder with the cms built
> > > into it
> > > --cake
> > > --vendors
>
> > > now when i access the cms throughwww.mysite.com/cmsitworksjust
> > > great, but the problem is that i need to build the frontend itself,
> > > and since the cms has all the images etc in its webroot, i cant get to
> > > them with the normal site.
>
> > > Is there any way that i can tell the app to look into the cms webroot
> > > folder as well or just go get its files there? Because the minute i
> > > mess with the advanced installation or with the htaccess files the
> > > normal site fubars.
>
> > > Can anyone help me?
>
> > > Best Regards
> > > Shackadoodl
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to