can't get stack permissions right.

Permalink
hi,
we're trying to make a account for the customer (with customer i mean my customer, so the one who asked me to build a site for him what he can manage himself) who needs to edit his page with limited permissions, so they could not do things that we only may do as admins.
i only have some problems, allready twittered some times with @concrete5, but get the advise to post it here.
my situation.
when i am logged in as administrator, i want to add the content to all pages on some places, mostly header and footer content. i have tryed it with stacks and global content, but can't really get what i want. lets explain it here:

when i make it with stacks, i have a whole list of stacks, for example headnav, subnav, headerimg tagcloudlink etc. i set the stacks by hardcode it into my template.
now i want the customer account to put content to the pages. when they click add stack, they must not see headnav, subnav and headerimg, becouse thats for me as administrator only. but in the tagcloud they must be able to add own tags with links to pages. i can't get it this way. when i for example go to dashboard>stacks>headnav>permissions concrete5 twitter said i had to set View Area... i tried
- when i set it to guest, and log in to my customer account, try to add content, and choose add stack, i see it in add stack. thats not what i want, i only want tagcloudlink to showup there.
- when i set it to only administrator, and log out so i view the page as visitor, or log in as customer, the head navigation is not showing up at all. and yes, when i log in as customer, and choose to add stack, headnav is not showed like i want, but the visitor of course has to see it, otherwise he could not visit the pages.
- what would be better would be the following: when you take a look at the blocks, i can go to: dashboard>blocks and stacks permissions>Add Block > Options. there i could set options who may ADD a block. thats all i want with the stacks. but there is no options menu on stacks like you have at blocks :(

is there a way i can get stacks working a bit like how i want. any way to let everyone view the stacks, but don't let show up the names under "add stack" for my customer user?


i also tried global area's instead of the stacks.
- first it took me a while to find out that when i changed my add stack codes into global area codes in my theme, the stacks automaticaly appeared, becouse global area's are handled like stacks.
- so when i found out that, i maked a bulk of new stacks with a 1 before it, copy'd all content from the original stacks to the stacks with 1 before it. then deleted the original stacks. and added the content of the stacks with 1 before it to the global area's directly. i saw that that maked the global area's appear under the stacks, but now in an own list of global area's. that maked me happy, becouse the "admin only stacks" did not appear anymore to the customer under "add stack". but now it was hard to handle the permissions of the global area's. for example i want the global area address so that the customer can not add additional content to it, but on the tagcloud, the customer must can add a tagcloudlink block. it took a while and could not set the right so that the customer account could add content to it, whatever we tried, it did not get the right permission. later we changed the global area name to something else, and wow, we could set the right permissions now :S what the problem was, no idea.
- an other thing thats not so good is that te customer gets the "add content" divs visible on the global area's that he may not edit. with stacks i dont have that problem.

my botomline questions:
- actualy i love to work with stacks in my template more than global area's. is it possible to hide the stacks from the "add stack" menu for only one user? (if not, this is a feature request for the concrete5 team to add the options menu where you can set the users who may add the stack just like you hve at blocks....)
- if it is not possible at all, what is the way you have to make global area's and manage the rights? are there multiple places to set that permissions? becouse i could not get the right of that tagcloud area ad i wanted untill we changed the name of it. the original stack was allready deleted. maybe there was left some permissions in the database that where not deleted when deleting my original stack? if that could be the couse i think its a bug?)

what would you advise me to do when building my next websited with concrete5?

thanks,
Bart

 
mkly replied on at Permalink Reply
mkly
Greetings,
Part of your issue may have to do with the fact that you are using Stacks for two different things and so you are having difficulty using different permissions.

For your set up, I would only use stacks for the user content(Tags etc) and then use a "Fake Stack", which is basically a page that only the Administrator can view.

1. Create a page for each of the things that you wanted to use for a hard coded Stack. For example create a page 'Header Nav'. It can be any Page Type, but Full is probably a good choice. Make a note of the URL Slug when you create this. We will be using that for your "Page Path" later.

2. Set the permissions for the "Header Nav" page to only Administrators groups.

3. Set the "Main" Area of the "Header Nav" page to override permissions and give the "Guest" group "View" permissions.

4. Add blocks you want to display to "Guests" to the "Main" Area of the "Header Nav" Page.

5. In your theme, in order to Hard Code the "Fake Stack" use some code like this. This code assumes you are using PHP 5.3+. If not you'll need to modify the array_filter() part. This code will display on every page _except_ the "Header Nav" we created, since we want to only edit these in the normal "Main" Area.
<?php
  array_filter($GLOBALS['c']->getPagePaths(), function($path) {
    return $path['cPath'] !== '/header-nav';
  })
  &&
  ($p = Page::getByPath('/header-nav'))
  &&
  ($a = Area::get($p, 'Main'))
  &&
  $a->display($p)
?>

The above code first checks to make sure we are not on the "Header Nav" page we create. Then it attempts to get the "Fake Stack" we created. If successful it attempts to get the "Main" Area of that page. If successful if displays the "Main" Area of the Page "Header Nav".

I should note that some blocks will not work as well when Hard Coded like this if they use javascript that needs to be added to the header. It gets a bit more complicated so let me know.

Hopefully this gets you close to achieving what you are trying to accomplish.

Best Wishes,
Mike
VolgensBartjes replied on at Permalink Reply
thanks for your reply, i can imagine that it could work right. but as you say, it dont work right for the javascript i think. and, i don't think this is the way how the concrete5 team has designed the system? i have asked them to look at this topic and let me know what is the best way to solve this.
JohntheFish replied on at Permalink Reply
JohntheFish
Another possibility with similar functionality is a global areas block or parent are block:

http://www.concrete5.org/marketplace/addons/global-areas/...
http://www.concrete5.org/marketplace/addons/parent-area/...
VolgensBartjes replied on at Permalink Reply
an colleague here at the office is advising me to not use stacks for this. he say to only use stacks for things that users may add/edit, and all things i want to hardcode in my template, just add an area with limit 1 and not give the user permission to change the area. then i can add my default content to it just using the editor for the page types. the only thing is that if i have for example an address content block, and something changes, i have to change it on all my 3 page types. at this site thats no big problem, but when you are going to work with a site with 10 page types, its not really fast to have to edit content in header or footer 10 times if something changes.
i think when i see all of this, its not possible just with stacks. i'll try the suggestion from my colleague now.

remains only my question to the concrete5 core team:
- is it right that i can't really use stacks in the way i want at this moment?
- could you maybe add the options tab on block and stack permissions>add stack, just like it is on blocks, so we can choose what user may add a certain block and who not? it would be a nice extra feature ;)

Bart