Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Using a normalized database structure instead of json for assets
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 26 - 30 of 30 - Collapse all  -  Translate all to Translated (View all originals) < Older 
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Herman Peeren  
View profile  
 More options Oct 28 2012, 3:52 am
From: Herman Peeren <herman.pee...@gmail.com>
Date: Sun, 28 Oct 2012 00:52:03 -0700 (PDT)
Local: Sun, Oct 28 2012 3:52 am
Subject: Re: [jplatform] Using a normalized database structure instead of json for assets

Some more practical remarks about the current ACL *implementation*. When
you are now developing a component (in the CMS) using item level access
control you'll have to do quite some things (see list below) in *every *component.
Such repetitive tasks could be done by a framework (or "platform" or
whatever you call it). That could be improved by:

   - providing better defaults on which to fall back
   - providing a simpler interface.

Example: when implementing item-level access control you now need to
override the _getAssetParentId() method in your JTable:

   - if that method checks for item-level access control by default we
   wouldn't have to write that same piece of code over and over again. Using
   my own JTable extension to provide that for my own components is only half
   a solution: then we would need an extension of JTable and one of
   JTableNested. Better just fix it in JTable (which I now do with an override
   of JTable...).
   - I like the flexibility so that I can overwrite/extend methods like
   that, but in most cases a default parent asset could be provided by the
   system (which table does it belong to and does it have categories?).
   - _getAssetParentId() provides the AssetParentId by retrieving the id of
   the asset's parent and you retrieve that by using the asset's parent name.
   If you would simply provide the asset's parent name to the access control
   interface, then that access control package can check the asset_id.The
   asset_id could be kept internally, behind the interface.

When developing a component with item-level access control you now have to

   - provide settings for the component-level permissions in the config.xml
   (could be available by default)
   - provide a list of actions for various levels (sections) in access.xml
   (could be available by default for the core actions)
   - add an options toolbar in your view (could be available by default)
   - restrict access to the component's backend in the entry file (could be
   available by default)
   - Add an asset_id to the item's database table (we could make it so,
   that the asset_id is not necessary outside the access package)
   - Bind and store the permissions in the assets table (could be done by
   default).
   - Provide the GUI for editing the permissions at the item level if
   someone is entitled to manage that (could be done by default)
   - add some language strings (some could be more general to fall back on
   by default).

Providing an overridable/extendible default could save a lot of work and
complexity.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Herman Peeren  
View profile  
 More options Oct 28 2012, 8:09 am
From: Herman Peeren <herman.pee...@gmail.com>
Date: Sun, 28 Oct 2012 05:09:40 -0700 (PDT)
Local: Sun, Oct 28 2012 8:09 am
Subject: Re: [jplatform] Using a normalized database structure instead of json for assets

*implementation*
Still studying everything that has been said in this thread, for I think
there are some usefull things in it.

One thing just to clear up: I assume when Andrew mentioned 3NF as opposed
to JSON, he meant 1NF.  Oct. 25: "storing complex access control rules in
3rd normal form" and Oct. 27: "not overly expensive in either JSON or 3rd
normal form (inheriting in 3rd normal form though, that gets fun)". For
anyone wanting a simple explanation about database normalisation, here is
an article I wrote 5 years ago:
http://www.yepr.nl/PracticalDatabaseNormalisation.pdf

Storing a JSON blob instead of atomic values is in some ways comparable to
what a document database (like MongoDb or CouchDb) does. There can
certainly be cases where that works much faster. If this is the best way to
store rules in our ACL-system mainly depends on how the data must be
available: if you would need a list of what you can do, then it is not the
best way. A way to solve that could be to use a graph to store those data
(and optimising handling of that graph) or to store it redundantly (in 2
formats). As usual all methods have their advantages and disadvantages, but
by quantifying the needs and costs we could find the optimal solution for
us. Or implement several strategies, so the optimal way can be chosen
depending on the situation.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
klas berlič  
View profile  
 More options Nov 6 2012, 7:22 am
From: klas berlič <klas.ber...@gmail.com>
Date: Tue, 6 Nov 2012 13:22:39 +0100
Local: Tues, Nov 6 2012 7:22 am
Subject: Re: [jplatform] Using a normalized database structure instead of json for assets

I'm not trring to convince anyone - I just though I could offer something
that is already done and could benefit all - facts (see my reply to Herman)
should be good enough. Implementation and details certainly have a lot of
room for improvement, but complex JSON data in relational database is not
anti pattern, it is just plain wrong. To the level of basics wrong.

Anyway, this discussion is now pointless as I changed my mind after reading
your reply.

2012/10/27 Andrew Eddie <mambob...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
klas berlič  
View profile  
 More options Nov 6 2012, 7:00 am
From: klas berlič <klas.ber...@gmail.com>
Date: Tue, 6 Nov 2012 13:00:42 +0100
Local: Tues, Nov 6 2012 7:00 am
Subject: Re: [jplatform] Using a normalized database structure instead of json for assets

 10% decrease I mentioned earlier applies only to view action vs. vielewels
performance where we are comparing oranges and apples ( could be
workarounded by replacing viewlevels with precalculated groups that have
view access on an item and refresh this whenever acl tree changes - but as
caching already solves performance problem this would probably be redundant
to do )

When we are talking about JSON in database vs. using normalized structure
for Joomla ACL, there can be no question which one to use at all - *experiments
in real Joomla environment clearly show that when we are talking about
single items there is not much difference* (difference is smaller than
error of measurement),* but for multiple items - lists *(e.g. blog
view)*normalized database works from 1000 to 100000% faster,
*depending on number of items and used php vs. mysql server performances.

2012/10/28 Herman Peeren <herman.pee...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven Pignataro  
View profile  
 More options Apr 18, 5:12 pm
From: Steven Pignataro <ste...@corephp.com>
Date: Thu, 18 Apr 2013 14:12:02 -0700 (PDT)
Local: Thurs, Apr 18 2013 5:12 pm
Subject: Re: [jplatform] Using a normalized database structure instead of json for assets

Hey gang - I know I am bringing up a old subject but I wanted to see if there is any solution to this.

I have a client that wants to have the grid view ONLY show what the user has edit access to in the grid. They have 30k+ articles and if I modified the model I would have to pull ALL of the data and run it through the authorize function. Because of the JSON values I have no way of properly implementing this into a query to perform the results that they want. Right now if a user loads the content grid the page shows content they click on which means they don't have core.edit access. Same with the filter for the drop down of Categories. They have hundreds of categories. It should only show what the user has access to.

I saw this function in the user.php file the other day:

<code>
public function getAuthorisedCategories($component, $action)
        {
                // Brute force method: get all published category rows for the component and check each one
                // TODO: Modify the way permissions are stored in the db to allow for faster implementation and better scaling
                $db = JFactory::getDbo();
                $query = $db->getQuery(true)->select('c.id AS id, a.name AS asset_name')->from('#__categories AS c')
                        ->innerJoin('#__assets AS a ON c.asset_id = a.id')->where('c.extension = ' . $db->quote($component))->where('c.published = 1');
                $db->setQuery($query);
                $allCategories = $db->loadObjectList('id');
                $allowedCategories = array();
                foreach ($allCategories as $category)
                {
                        if ($this->authorise($action, $category->asset_name))
                        {
                                $allowedCategories[] = (int) $category->id;
                        }
                }
                return $allowedCategories;
        }
</code>

This makes me realize why it takes a while to load some areas that call this function - because it is looping through ALL of the categories which is a HUGE amount.

I took the same concept and decided to do that to the query for the model - which was detrimental to the performance (although it provided the right results).

So my question to this post is: Has there been any progress on this issue or is there any way to add getListQuery() for com_content to determine if the user has access to it from it group - instead of loading it ALL the content and passing each through $user->authorise()?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages < Older 
« Back to Discussions « Newer topic     Older topic »