ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

MSM + Members: Can't create a member that can only access "site 2" without access to "site 1".

April 26, 2011 10:26pm

Subscribe [6]
  • #1 / Apr 26, 2011 10:26pm

    Hello,
    I’ve got an EE v2.1.0 Build 20110411 MSM site that I need to create a member group for that only has access to 1 sub site.
    Here is what needs to happen:

    These are the sites in my MSM installation, they’re all part of the same network of operators.
    Site 1 is the core site with most functionality on it.
    Site 2 is a micro blog, Site 3 is the same but with a different topic as its content.

    ***
    mainsite.com (Primary, Site 1)
    site2.com (Slave, Site 2)
    site3.com (Slave, Site 3)
    ***

    Most users have access to Site 1 and either Site 2 or 3 but this company has recently brought on board a contractor to help with the content creation for Site 2.

    So how do I create a member group (for which this contractor would be come the registered user) that can only access Site 2 without any access to either Site 1 or 3?

    Thanks,
    Jannis

  • #2 / Apr 27, 2011 1:30pm

    Sue Crocker

    26054 posts

    Hi, Jannis.

    The easiest thing to do is to create a masked login for the secondary site. For more information see:

    EEDocs:// Masked CP Access

    NOTE: The only problem with this approach is that they can still try to change to a different site from inside the control panel, but will be unable to do so. That’s a known issue that is being worked on.

    Does that help?

  • #3 / Apr 28, 2011 7:01pm

    Hi Sue,
    I followed the instructions and got the Masked CP working without any problems but once I log in through the masked url and then try to use the site toggle (top right) something strange happens.
    Instead of a “Not authorized” or even “error” page I get redirected to the Site 2 CP Homepage but the page is loaded twice, underneath one another.

    I have attached a screenshot of the issue.

    Any ideas what would be causing this? (Browser is Google Chrome, latest version obviously)

    Thanks,
    Jannis

  • #4 / Apr 28, 2011 7:09pm

    Sue Crocker

    26054 posts

    Hi, Jannice. The bug you posted is the one I was referring to.. let me see if I can find it. It doesn’t matter which browser it is.

    I have a later version to test with, but I don’t believe this was fixed in the 2.1.4 beta.

  • #5 / May 12, 2011 12:20pm

    a la mode

    168 posts

    Sue,

    I am having a similar issue. The only difference is I have 7 sites. I want the user to only have access to say site 4. When I set up a user group with the authority to only access the CP of that site, they can’t log on. The user gets an error “You are not authorized to perform this action”.

    In order to get them the ability to log in, I have to allow them access to the primary or first site created. The problem is that I don’t want them to have access to this site. They only need access to the site I have flagged in the user group.

    Why is this such a problem?

    Thanks,

    *** EDIT
    EE v2.1.3 - © Copyright 2003 - 2010 EllisLab, Inc.
    Script executed in 0.1058 seconds - 31 SQL queries used - Build:  20101220

    *** EDIT
    EE v2.1.3 - © Copyright 2003 - 2010 EllisLab, Inc.
    Script executed in 0.1345 seconds - 27 SQL queries used - Build:  20110411

  • #6 / May 12, 2011 3:45pm

    Brandon Jones

    5500 posts

    Brian,

    The masked access method Sue referred to is the way to go in these cases. Does that work?

  • #7 / May 12, 2011 3:59pm

    a la mode

    168 posts

    Brandon,

    I tried that and was unable to get it functioning. I even had another person look at it and go through the process, but both of us were stumped. It seems like such an easy process, but following the instructions to a “T” didn’t seem to work for us.

    I know it is more than likely something overly simple that we are somehow missing.

    Just to clarify on the Masking of the CP:

    Q: when you create the admin.php file, if all of the sites are in folders relative to the system site(actual EE install), can the admin.php be placed in those folders or does it need to reside in the EE install folder?

      ex. - Current Layout
            SERVER ROOT
              EE_INSTALL/SYSTEM
              SITE_1
                  index.php
              SITE_2
                  index.php
              SITE_3
                  index.php
              SITE_4
                  index.php


      can the admin file go in each like so?
            SERVER ROOT
              EE_INSTALL/SYSTEM
              SITE_1/_admin/admin.php
                  index.php
              SITE_2/_admin/admin.php
                  index.php
              SITE_3/_admin/admin.php
                  index.php
              SITE_4/_admin/admin.php
                  index.php


      or would the admin file need to reside in the install directory?
            SERVER ROOT
              EE_INSTALL/SYSTEM

    ~~          EE_INSTALL/SITE_1/admin.php
    ~~          EE_INSTALL/SITE_2/admin.php
    ~~          EE_INSTALL/SITE_3/admin.php
    ~~          EE_INSTALL/SITE_4/admin.php

              SITE_1
                  index.php
              SITE_2
                  index.php
              SITE_3
                  index.php
              SITE_4
                  index.php


    I hope that makes sense…

    Thanks,

  • #8 / May 12, 2011 4:21pm

    Brandon Jones

    5500 posts

    Hey Brian,

    Yes, that should be do-able. You can stick admin.php (or whatever you call it) anywhere that’s publicly accessible, as long as it can access the system folder and you’ve properly set that system folder path in it.

  • #9 / May 12, 2011 5:24pm

    a la mode

    168 posts

    I thought I should be able to, but I was unable to get it to work.

    Here are the steps I took…

    (From EE Docs)

    <img1.jpg> == Folder Structure on server. SYSTEM is where my EE Install resides.

    Inside of SYSTEM is my ‘system’ folder. I copied the index.php file from there and placed it in a folder located inside of SITE1. I then renamed this file ‘admin.php’.

    <img2.jpg> == Folder Structure on server with ‘_admin’ folder.

    Now in this ‘admin.php’ file, I have uncommented the line for MASKED CP ACCESS.

    /*
     * --------------------------------------------------------------------
     *  MASKED CP ACCESS
     * --------------------------------------------------------------------
     *
     * This lets the system know whether or not the control panel is being
     * accessed from a location outside the system folder
     * 
     * NOTE: If you set this, be sure that you set the $system_path and the 
     * 'cp_url' item in the $assign_to_config array below!
     * 
     */
        define('MASKED_CP', TRUE);

    I then changed my ‘$system_path’ to point to the actual system folder, using a relative path.

    /*
     * --------------------------------------------------------------------
     *  SYSTEM PATH
     * --------------------------------------------------------------------
     *
     * The following variable contains the server path to your
     * ExpressionEngine "system" folder.  By default the variable is left
     * blank.  If you need to run your CP from somewhere other then 
     * the default location you can set name here and move a copy of this
     * file to that location. If you set the name, please include the 
     * server path. The path can be a simple relative path or it can 
     * be a full server path.
     *
     * Example:  $system_path = './mysecretfolder';
     * 
     */
        $system_path = "../../SYSTEM/system";

    I then uncommented the ‘cp_url’ override and entered the URL as:

    /*
     * --------------------------------------------------------------------
     *  CUSTOM CONFIG VALUES
     * --------------------------------------------------------------------
     *
     * 'cp_url' is typically the only config override variable
     *  that would need to be managed in the control panel index.php file
     *
     * Un-comment the $assign_to_config array below to use this feature
     *
     */
        $assign_to_config['cp_url'] = 'http://myDomain.com/_admin/admin.php'; // masked CP access only

    Now, according to the documentation on the site, I needed to add a ‘site_name’ variable to the array because I am using MSM, so I added this directly below the last one. (‘cp_url’)

    $assign_to_config['site_name']  = 'SITE1';


    This is how it looks to be on the documentation and everything else I have read, however, when I try to navigate to that location, I end up getting a page rendering the SITE1 without anything on it. (Like a blank page)

    I hope this all makes sense…

    Thanks,

  • #10 / May 13, 2011 7:37am

    John Henry Donovan

    12339 posts

    Brian,

    In same file can you turn debug on then visit the previously blank page. Does an error appear?

    $debug = 1;
  • #11 / May 13, 2011 11:25am

    a la mode

    168 posts

    John,

    Thanks, but nothing. The only thing that shows is the template rendering from the site index page. In which is simply this:

    {if last_segment==""}
        {embed="site/home"}
    {if:else}
        {channel}|{entry_id}
        Nothing
    {/if}

    Which renders…

    Blog Entry|79
    Nothing

    Thanks,

  • #12 / May 13, 2011 11:59am

    Sue Crocker

    26054 posts

    Hi, Brian.

    I have a site called eebeginners which has the following settings in it (index.php) taken from the primary site’s index.php:

    $assign_to_config['site_name'] = 'begin';
        $assign_to_config['cp_url'] = 'http://eebeginners.com/admin.php';
        $assign_to_config['site_url'] = 'http://eebeginners.com';

    admin.php (a renamed version of the /system/index.php file) has:

    define('MASKED_CP', TRUE);
    
    /*
     * --------------------------------------------------------------------
     *  SYSTEM PATH
     * --------------------------------------------------------------------
     *
     * The following variable contains the server path to your
     * ExpressionEngine "system" folder.  By default the variable is left
     * blank.  If you need to run your CP from somewhere other then 
     * the default location you can set name here and move a copy of this
     * file to that location. If you set the name, please include the 
     * server path. The path can be a simple relative path or it can 
     * be a full server path.
     *
     * Example:  $system_path = './mysecretfolder';
     * 
     */
        $system_path = "../system";

    How does what I did differ from what you did?

  • #13 / May 13, 2011 12:18pm

    a la mode

    168 posts

    Sue,

    Your post poses a question…

    You mentioned :

    I have a site called eebeginners which has the following settings in it (index.php) taken from the primary site’s index.php:

    $assign_to_config['site_name'] = 'begin';
    $assign_to_config['cp_url'] = 'http://eebeginners.com/admin.php';
    $assign_to_config['site_url'] = 'http://eebeginners.com';

    You have this in the ‘index.php’ file of the ‘eebeginners’ website?

    If so, that could be where I am going wrong. I have all of that in the ‘admin.php’ file, NOT the ‘index.php’ file.

    Thanks,


    ***EDIT
    I guess to clarify…
    in your eebeginners site, do you have an ‘index.php’ file AND an ‘admin.php’ file?

    also, I noticed the same options for some in both files. Do you set them in both files?

  • #14 / May 13, 2011 3:23pm

    Kevin Smith

    4784 posts

    Hey Brian—

    Yes, Sue has both an index.php file as well as an admin.php file in her setup. The secondary site’s index.php file is a modified copy of the primary site’s index.php (the one you’ll find in the web root). The instructions for creating this file are detailed here.

    The secondary site’s admin.php file is a modified copy of the primary site’s system/index.php file. Instructions for creating this file are here.

    The admin.php file is used for each MSM’s secondary site to mask the location of the system folder so that, as an example, users logging into your secondary site’s CP won’t necessarily know that there are other sites on the same installation.

    Does that help clear things up?

    Kevin

  • #15 / May 13, 2011 5:59pm

    a la mode

    168 posts

    Kevin,

    Yes it does clear things up. Unfortunately, that is exactly as I did and it is not working for me at all.

    The only thing that happens is as shown in the earlier post. The template is hit and the admin.php never gets hit/rendered to take me to the CP.

    I am lost as to what the problem can be. I have had multiple people look at the setup and run through the instructions to see if anything looked “off” but none of them have seen/found anything.

    This is very frustrating. We are all working for the same company here so everyone having access to one location to log into the CP would be fine, but I still need to be able to set permissions without giving everyone a) Super Admin or b) access to the main/original site.

    Confused/Frustrated,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases