[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] skel class.base.php,NONE,1.1.2.1
From: |
Dan Kuykendall <address@hidden> |
Subject: |
[Phpgroupware-cvs] skel class.base.php,NONE,1.1.2.1 |
Date: |
Thu, 23 Oct 2003 07:04:05 +0000 |
Update of /cvsroot/phpgroupware/skel
In directory subversions:/tmp/cvs-serv10815
Added Files:
Tag: nextgen
class.base.php
Log Message:
adding the new framework code
--- NEW FILE: class.base.php ---
<?php
/**************************************************************************\
* phpGroupWare
*
* http://www.phpgroupware.org
*
* This file written by Dan Kuykendall <address@hidden> *
* Copyright (C) 2003 Dan Kuykendall
*
*
-------------------------------------------------------------------------*
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id: class.base.php,v 1.1.2.1 2003/10/23 07:04:00 seek3r Exp $ */
class skel_base
{
var $sec;
function start()
{
$args = new safe_args();
$args->set('answer', '##NOVAR##', 'any');
$args = $args->get(func_get_args(),__LINE__,__FILE__);
$result['text'] = '|| skel app ||';
switch($args['answer'])
{
case '##NOVAR##':
$GLOBALS['phpgw']->add_xsl('api.widgets');
$result['dialog'] = array(
'text' => 'Do you think this
will actually work?',
'op' => 'skel.base.start',
'current_inputs' => array(
0 => array(
'name' => 'a',
'value' => 'aa'
),
1 => array(
'name' => 'b',
'value' => 'bb'
),
2 => array(
'name' => 'c',
'value' => 'cc'
)
)
);
break;
case 'Yes';
$result['answer'] = 'Apparently you
already know of my genius. Very well, I will let you live.';
break;
case 'No';
$result['answer'] = 'You doubted my
skill? You bastard!';
break;
}
$GLOBALS['phpgw']->add_xsl('skel.base');
return $result;
}
function home_hook()
{
$args = new safe_args();
$args->set('fname', '##NOTSET##', 'any');
$args->set('lname', '##NOTSET##', 'any');
$args = $args->get(func_get_args(),__LINE__,__FILE__);
$GLOBALS['msgbox']->add('Skel apps hook was
called!',__LINE__,__FILE__, 'notice');
// $GLOBALS['phpgw']->add_xsl('skel.home_hook');
// return $args;
}
function ttt($op, $rights)
{
if ($this->sec->check($op, $rights))
{
return $rights.' is valid';
}
else
{
return $rights.' is invalid';
}
}
function acl_tester()
{
$this->sec = createobject('api_acl',
array('account_id'=>9999));
$this->sec->get_memberships();
$result['text'][] = 'This test is going to delete all
your phpgw_acl records to ensure that the tests run as expected.';
$GLOBALS['phpgw']->db->query('DELETE FROM phpgw_acl
where acl_account=9999',__LINE__,__FILE__);
$result['text'][] = 'Action: DELETE FROM phpgw_acl';
$result['text'][] = ' ';
$result['text'][] = 'Running checks on skel.base.rtest
after changing directly granted rights as well as skels it will inherit from';
$result['text'][] = ' ';
$result['text'][] = '1: check rights for skel.base
which will get inherited by skel.base.rtest';
$result['text'][] = $this->ttt('skel.base', 1);
$result['text'][] = $this->ttt('skel.base', 2);
$result['text'][] = $this->ttt('skel.base', 4);
$result['text'][] = $this->ttt('skel.base', 8);
$result['text'][] = 'You can see that no rights are
set, so nskel will be inherited';
$result['text'][] = ' ';
$result['text'][] = '2: checking skelbase.rtest';
$result['text'][] = $this->ttt('skel.base.rtest', 1);
$result['text'][] = $this->ttt('skel.base.rtest', 2);
$result['text'][] = $this->ttt('skel.base.rtest', 4);
$result['text'][] = $this->ttt('skel.base.rtest', 8);
$result['text'][] = 'You can see that no rights are set
directly as well';
$result['text'][] = ' ';
$result['text'][] = '3: add rights 4 to
skel.base.rtest';
$result['text'][] = 'Action:
$acl->add(\'skel.base.rtest\',4,0);';
$this->sec->add('skel.base.rtest',4,0);
$result['text'][] = $this->ttt('skel.base.rtest', 1);
$result['text'][] = $this->ttt('skel.base.rtest', 2);
$result['text'][] = $this->ttt('skel.base.rtest', 4);
$result['text'][] = $this->ttt('skel.base.rtest', 8);
$result['text'][] = ' ';
$result['text'][] = '4: add rights 8 to
skel.base.rtest';
$result['text'][] = 'Action:
$acl->add(\'skel.base.rtest\',8,0);';
$this->sec->add('skel.base.rtest',8,0);
$result['text'][] = $this->ttt('skel.base.rtest', 1);
$result['text'][] = $this->ttt('skel.base.rtest', 2);
$result['text'][] = $this->ttt('skel.base.rtest', 4);
$result['text'][] = $this->ttt('skel.base.rtest', 8);
$result['text'][] = ' ';
$result['text'][] = '5: remove rights 4 from
skel.base.rtest';
$result['text'][] = 'Action:
$acl->remove(\'skel.base.rtest\',4,0);';
$this->sec->remove('skel.base.rtest',4,0);
$result['text'][] = $this->ttt('skel.base.rtest', 1);
$result['text'][] = $this->ttt('skel.base.rtest', 2);
$result['text'][] = $this->ttt('skel.base.rtest', 4);
$result['text'][] = $this->ttt('skel.base.rtest', 8);
$result['text'][] = ' ';
$result['text'][] = '5: set rights to 2 on
skel.base.rtest';
$result['text'][] = 'Action:
$acl->set(\'skel.base.rtest\', 2,0);';
$this->sec->set('skel.base.rtest', 2,0);
$result['text'][] = $this->ttt('skel.base.rtest', 1);
$result['text'][] = $this->ttt('skel.base.rtest', 2);
$result['text'][] = $this->ttt('skel.base.rtest', 4);
$result['text'][] = $this->ttt('skel.base.rtest', 8);
$result['text'][] = ' ';
$result['text'][] = 'Now to see inheritance in
action...';
$result['text'][] = '6: add rights 8 to skel.base';
$result['text'][] = 'Action:
$acl->add(\'skel.base\',8,0);';
$this->sec->add('skel.base',8,0);
$result['text'][] = $this->ttt('skel.base.rtest', 1);
$result['text'][] = $this->ttt('skel.base.rtest', 2);
$result['text'][] = $this->ttt('skel.base.rtest', 4);
$result['text'][] = $this->ttt('skel.base.rtest', 8);
$result['text'][] = 'You can see here that it has
inherited rights 8 from skel.base';
$result['text'][] = ' ';
$result['text'][] = '7: add rights 4 to skel.base';
$result['text'][] = 'Action:
$acl->add(\'skel.base\',4,0);';
$this->sec->add('skel.base',4,0);
$result['text'][] = $this->ttt('skel.base.rtest', 1);
$result['text'][] = $this->ttt('skel.base.rtest', 2);
$result['text'][] = $this->ttt('skel.base.rtest', 4);
$result['text'][] = $this->ttt('skel.base.rtest', 8);
$result['text'][] = 'You can see here that it has also
inherited rights 4 from skel.base';
$result['text'][] = ' ';
$result['text'][] = 'Now to see inherited rights masks
in action...';
$result['text'][] = '8: add rights mask for 8 to
skel.base';
$result['text'][] = 'Action:
$acl->add(\'skel.base\',8,1);';
$this->sec->add('skel.base',8,1);
$result['text'][] = $this->ttt('skel.base.rtest', 1);
$result['text'][] = $this->ttt('skel.base.rtest', 2);
$result['text'][] = $this->ttt('skel.base.rtest', 4);
$result['text'][] = $this->ttt('skel.base.rtest', 8);
$result['text'][] = 'You can see here that it no longer
inherited rights 8 from skel.base';
$result['text'][] = ' ';
$result['text'][] = 'It will help to see the rights for
skel.base at this point to clearly see the rights mask doing its work';
$result['text'][] = '9: display rights for skel.base';
$result['text'][] = $this->ttt('skel.base', 1);
$result['text'][] = $this->ttt('skel.base', 2);
$result['text'][] = $this->ttt('skel.base', 4);
$result['text'][] = $this->ttt('skel.base', 8);
$result['text'][] = 'You can see here that it has
rights for 4 and 8, and yet above you saw that skel.base.rtest did not
inherited rights 4 from it';
$GLOBALS['phpgw']->add_xsl('skel.acl_tester');
return $result;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] skel class.base.php,NONE,1.1.2.1,
Dan Kuykendall <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] skel/skins/default acl_tester.xsl, NONE, 1.1.2.1 base.xsl, NONE, 1.1.2.1 home_hook.xsl, NONE, 1.1.2.1
- Next by Date:
[Phpgroupware-cvs] skel/skins - New directory
- Previous by thread:
[Phpgroupware-cvs] skel/skins/default acl_tester.xsl, NONE, 1.1.2.1 base.xsl, NONE, 1.1.2.1 home_hook.xsl, NONE, 1.1.2.1
- Next by thread:
[Phpgroupware-cvs] skel/skins - New directory
- Index(es):