cakephp application design query - php

I am really a new bee in cakephp development. I've got a design question and would like to get some ideas.
The web application is for a big corporation and each child companies underneath is exactly the same. one child company can not see data from another child company. so at this stage my query is should I build build separate replicated apps, each represent one child company. if so then data aggregation would be a big job in terms of running overall reports. the other option is to build one big application and display/hide data based on the user logged in (user and location of the company).
the next big problem is within each small company there are different units and only certain data is visible across. for example publication department can see customer details but not customer's order history details. from each company one admin user have a right to see all the details. its like each business unit represent a module with certain data visibility. I know cake has fantastic authentication module to handle this but what I need to know is should I put authentication based on controller level or action level? so then each business unit = one big controller
hope this description will give you some sort of vague idea of what i am trying to build.
thanks in advance

You can use ACL.Take a look here ACL tutorial or use a plugin like Alaxos Plugin

Related

Doctrine / ExtJS: Use model to create another model

I'm having difficulties implementing some of the features my client would like to have.
We're building a shopware shop, which is almost done. I've developed some plugins and customizations to have the shop fit my client, but I'm not the best at backend development using ExtJS and Doctrine.
The situation is: The shop sells car parts. We've bought a third-party plugin that allows us to enter ktype numbers for each product, so that the client can search for his/her car in the frontend and get all fitting products.
The plugin has it's own window in the backend, which isn't very comfortable.
So I created an extra tab in the article details, which displays all entries from the database using the third-party model.
That wasn't so hard since the model and database were created by the third-party plugin and I just had to query the data and display it.
What I'm trying to accomplish is: I added an extra column (selected) with a checkbox, where the admin can choose the cars the article fits to.
The plan was to read the textfield "ktypes" of the article on load, check all corresponding checkboxes and then when a checkbox is altered just save the new ktypes array to the article.
Problem is, that this way I can't sort by that column since it's not in the ExtJS store/model.
So now I'm thinking I'll create my own Model with all the columns from the third-party model, add a article_id column and a selected column and reference everything there.
What I don't know is: How to I get the contents of the third-party model into my own database?
The third-party plugin doesn't reference the article. The table only holds all car data imported from a csv list. The reference between an article and the data is just a textfield in the article details.
I thought about Doctrine associations, but I don't really have a reference point or foreign key...
Has anyone got an idea how to solve this?
Can share code if that helps...
Thanks!
I went in a different direction but still need help. Will post a new question though since it's a different topic.
Thanks for trying to help!

How To Break Up Company Website Into Groups To Manage Their Content

I've been looking around and not finding any good answers. I work at a small company. They have a quick information website for internal users. It needs updating but here is the situation. I want each group to be able to manage their own page/s contents. For instance HR to manage their documents, another group to manage the phone directory,etc. I don't want them all to have to be trained or take training on any extensive software. It doesn't even have to have a lot of features probably. I've been looking at possibly Joomla as our group already knows PHP, Apache, etc. But haven't really got a good feel if I can break the content up and assign certain areas to certain groups inside of it so they only have access to change their own content only.
Right now all of it's on one page and grew out of hand before I got here to 2 page list of items without a collapsible menu. I do like that some areas all they have to do is drop files on a file share to update their items. I may keep part of that, just break it up into separate pages instead of showing each in one single frame in the middle as you click on the menu item. Since most of it is documents it's not all that bad.
Anyway looking for someone that's already been down this road and has a feeling for what I'm trying to do and how to go about it.
BTW prefer something open source if adding on any product to what we have.
Joomla since version 1.6 has fine grained access control that you can customise your self. Normally what I would do is create a user group for each of your groups. THen create a category tree for that group to make and manage their articles. Then for each of these categories give members of the group permission to create, edit, delete or whatever you want them to have.
THere is a lot of documentation out there on how to do this. (Some by me :)) Just search for Joomla ACL or Joomla Access Control.
If you have using joomla, you have the choice to edit your mysql database, there are two tables you need to edit, one is users, the other is usergroup_map. Each group should have a group ID and its own permission. After you create a page, just assign the permission to the page. If you have more than 6 groups, you might also need to edit usergroup table to add more group ID

Is it possible (and how to?) divide application to backend (admin part) and frontend (user part) parts?

I am developing web application, using zend framework 2. In my app, I want some modules. News, for example, users etc.
Is it possible, to divide whole application to two big parts: front-end (for users) and back-end (for admins).
In front-end there will be part of News module, which render news list, full news item etc.
In back-end there will be part of News module, which will render list of all news, tools for editing, deleting etc.
At the moment, I have simple structure:
I have MyZfcAdmin module, with routes configurated so, that when I am writing /admin/news/edit/5 it will call NewsController edit action with id 5 and render it. So now, I have all actions (for admins and for users) in one controller. Is it possible to create something like this:
module
frontend
News
SomeMoreModule
backend
News
SomeMoreModule
I found topic on google questions, in that suggested to use this CMS, but I want to try it by myself.
Different people have different idea in managing application, for me I will have news module that handle all news related calls both admin parts and user accessible parts. The idea you have described have some side effects like duplication of code between modules and crossing of borders between isolate modules like calling action in another modules(it's ok if there are related or fall in hierarchy), which may have issues in long term maintenance of the applications.
IMHO I might suggest you could create modules like News, users, etc where it can have combined functionality of both admin and user access. You can later include user authorization plug ins using bootstrap events and restrict action accessible by admin and other users
There is not concept of submodules inside any module. But you can give them proper naming conversations. If code is not formed in oops properly, then there can be code duplication into your project. As per #raj's answer, it's good to give restrictions based on user role. If any action is not intersecting admin and user role then you can separate those actions, but actions like add or edit news content are same for both role then you should point to same action by router.

Symfony 1.3: Need to override backend filter field's set of data

My project is using Symfony 1.3.11, PHP version is 5.3.3.
Let me explain my case and my problem:
We wanted to add another kind of user, not just "user" and "admin" (using sfGuardPlugin). I did add "business" and I did give him permissions to only ONE admin module -- "purchases" (accessing own and under some conditions -- other people's purchases made on the site).
The "business" user can be associated to one or more Partners (firms) registered in the site, effectively allowing us to handle business owners or representatives a wee bit differently.
When the "business" user accesses the admin section, the list of purchases he sees must be this: All Purchases for all Products of all Partners he has associated with him. (Not exactly a trivial query).
I did that, in my opinion, in a stupid manner, but it does work -- namely overriding the "apps/backend/modules/purchase/actions/actions.class.php#executeIndex". I had to first copy-paste some code from the version of that method in the cache.
In short, I did hook myself to the "executeIndex" and added a code to do the proper Criteria, and the code works.
The problem now is this:
The filter field above the list (the one containing the Product list) does contain all possible Products. We want it to only contain all Products for all Partners the current user is associated with.
Thing is, it's my first time having to override the admin's filters and I am lost as to where should I plug my code.
Any help is appreciated. Thanks for your time.
UPDATE: Strangely very unpopular question. Nobody ever had to do this? Wow.
You have to unset the product_list and set another widget with the filtered choices.
Check this post where I explain something like that but using doctrine. In your case the sfGuardUserForm is your somthingFilterForm.
You could also filter data using this method. This is a little more elegant but both would work.

developing module with drupal

I have a website which is up and running on drupal. Its product based website. I developed by creating my own tables and writing php code using php filters. I never used module concepts. Since the site is running well, so i am thinking to move to module concept. so wanted some help here, like how to do it.. i have gone through module development concepts also.
requirement.
1. Admin should be able to create new products like Mobile, Camera.
2. He should be able to define product properties and properties for which user will rate on.
3. Admin/ second admin should be able to create new sub products under products like mobile - nokia 8850 , nokia 9980 where he enters details of product properties also.
4. A listing page for all the sun products under main product. and from listing page we go to to main sub product page where user rates the product.
My confusion : should i create a new table or drupal takes care of all the requirements. and how do i start with it.
update : clear picture of requirement
ex :
1. 1st i add a product "MOBILES"
2. Then i add properties for this main product.
3. Then i start adding sub products under MOBILES i.e nokia 1100, samsumg 2200 and etc.
while adding sub products, in this page it gives me a text box for all the propeties i defined while creating the main product MOBILES . So is this possible using CCK.
You're right to consider using modules and following the "Drupal way". Use CCK + Views and Drupal will take care of the table maintenance and querying for you.
As already mentioned, you will need to get familiar with the CCK module. This module will allow you to create new "content types", which in your example would be the different product types and their attributes. Here is a good overview video on CCK. With CCK you can define new content types and Drupal will create the basic content creation forms for you and hide spare you from all the database details when you're working with it.
The Views module is essentially a query builder and will allow you to create views of your content. There are all sorts of related modules that can help you render your data as charts, grids, lists, slideshows, tables, etc.
There is a slight learning curve but once you get past it you'll be able to build new things pretty quick.
Update: Just another thought, if you are really needing to create some kind of classification system you should look at Taxonomies.
It sounds like you could do all of this with modules, without needing to do any php coding at all. Check out (if you haven't already) cck, views, and fivestar.
In response to your update, sounds like CCK and Node Hierarchy should do everything you need.

Categories