Welcome Guest, Not a member yet? Register   Sign In
Khaos :: KhACL
#51

[eluser]adamp1[/eluser]
I don't know if you want to use InnoDB, but if you do then I have updated the delete AXO function so it actualy returns a result, since before you said it returned a bool but it didn't.

Code:
/**
     * Delete AXO
     *
     * @param string $axo
     *
     * @return bool
     * @access public
     */
    function delete($axo)
    {
        // grab the axo_id so we can delete the access -> action links later on
        if (!($rs = $this->_CI->db->query('SELECT id FROM '.$this->_Tables['axos'].' WHERE name = ? LIMIT 1', array($axo))))
            return false;
        
        if ($rs->num_rows() === 0)
            return false;
        else
        {
            $row    = $rs->row();
            $axo_id = $row->id;
        }
        
        // delete the AXO
        return $this->_CI->db->query('DELETE FROM '.$this->_Tables['axos'].' WHERE id = ? LIMIT 1', array($axo_id));
    }

EDIT: It might be better also to use active record for the queries so it can be used in other databases other than mysql
#52

[eluser]esra[/eluser]
Adam... I did something similar, including changing the varchar data types to a maximum of 254. MSSQL is one database server that needs this limit as a basic a requirement. Any database server running on Windows (and possibly the ODBC driver) needs this requirement. The reasoning has more to do with the number of bits per byte (i.e., using even multiples of bits per byte) as supported by a computer's microprocessor architecture.

It's safer to use the MySQL INNODB engine because referential integrity is in effect when foreign keys and unique keys are used, preventing stray data from originating in a table if a database server has a catastropic crash in the middle of a table update. Based on foreign key and unique key relationships, the INNODB engine can recover from such a crash by reconstructing the data based on the constraints established by those indexing keys. Performance differences between MyISAM and INNODB probably favors MyISAM because the INNODB engine needs to do more to provide more features and safer data integrity.

neophyte... I have been integrating your acl, caching, and event manager solutions into an application update currently underway. The thought struck me that if the event manager is added to the mix, it might be possible to add some abstraction to authentication at the application level, allowing multiple authentication schemes to be applied based on different plugins. That is, creating a generic api for authentication and writing plugins for that api. Do you think this is feasible?
#53

[eluser]adamp1[/eluser]
That was the main reason for using InnoDB over MyISAM, I would prefer slower but correct data than corrupt data which is useless. Thanks for the full explanation, I knew I had read a reason someone but couldn't remember it.
#54

[eluser]esra[/eluser]
The INNODB argument is probably even more valid when you consider the nature of nested sets where trees have to rebuilt (updating lft and rgt values of nodes) as hierarchy changes are made. There is a similar argument about using transactions with nested sets as a safety precaution.
#55

[eluser]adamp1[/eluser]
Right Neophyte, as said I updated the library to work with transactions, didn't implement the active record functions. I left some comments in where I remove some of your code and inserted the new code. Not a lot changed really.

http://pastebin.com/m26f9dbc7
#56

[eluser]Neophyte[/eluser]
Quote:neophyte… I have been integrating your acl, caching, and event manager solutions into an application update currently underway. The thought struck me that if the event manager is added to the mix, it might be possible to add some abstraction to authentication at the application level, allowing multiple authentication schemes to be applied based on different plugins. That is, creating a generic api for authentication and writing plugins for that api. Do you think this is feasible?

One of the primary reasons i created the events library was so i could do just that, if theres an interest i could release an 'KhAuth' which really would just be an API for authentication (that way you could have your apps native authentication as well as automatic auth for phpbb etc.. as plugins without having to code in explicit support for each into the rest of your code)
#57

[eluser]esra[/eluser]
I'm definitely interested in KhAuth. The concept itself puts to rest most if not all of the arguments for not supporting Auth natively in the core.
#58

[eluser]Neophyte[/eluser]
ChangeLog - KhACL - 0.1-alpha4

Fixed - Updated table schema with indexes where appropriate
Refactor - Updated all queries except for 2 (delete requiring join in ARO/ACO)
Feature - Transaction support when updates are required on the ARO and ACO trees
Feature - New helper method 'kh_acl_check' to avoid loading main library every page load
Feature - Support for KhCache when available (must be >= 0.3)

Due to the large number of query changes (i did test them all) but only the basics nothing complicated i'd recommend doing your own testing just incase if you are using a previous version.
#59

[eluser]Unknown[/eluser]
bug in Khaos::KhACL - 0.1-alpha4

we get error in the code when set db table prefix like

Code:
$db['default']['dbprefix'] = "ci_";

2 changes needs to be in khacl_helper.php file.
Line no. 62 and 74.

Code:
$ci->db->select('tree.id, tree.name, tree.link');

needs to be

Code:
$ci->db->select('tree.id, tree.name, tree.link', FALSE );

Please try testing your code using a prefix database tables .
Many error will be are encountered.

Great ACL Class.Keep up the good work.
#60

[eluser]depthcharge[/eluser]
Hi,

Thanks for a great addition Neophyte. I am a newbie here on this forum, and have only recently stumbled across CI, and like the fact that it is very customizable without being too bloated.

I can see great use for this ACL, will help me a lot.

I just a have a few questions.

1. I see the name field is unique, so no way of entering a user with multiple parents within the aro tree? In the (phpgacl) PDF provided in first few posts of this thread it shows han is within crew and within engineers. This is kind of confusing me, I cant see how I can add an aro named han and add him under 2 other aro's (crew and engine). Unless I call them Han1 and Han2 or crew_han and engineer_han?

2. Linking to existing user table, Could I get rid of the link field, and change the name field to user_id? I don't really want to duplicate a user's name within the database.

3. Does the amount of ARO's really make much of a difference in performance?

Thanks in advance


Lee




Theme © iAndrew 2016 - Forum software by © MyBB