+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Limit Access based on Localization (language)

Limit Access based on Localization (language)

9 posts, 0 answered
  1. Leon Williams
    Leon Williams avatar
    20 posts
    Registered:
    18 Mar 2010
    26 Apr 2010
    Link to this post
    The site I am working on will hae 3-4 different languages and some of language pages will be managed by the native speaker from their own country.  How can I limit access to the French content to only the French sitefinity user, and the Chinese pages to only the Chinese sitefinity user?  We want to specifically limit them from making changes to the English pages.  How can this be achieved in Sitefinity?  Is this something that can be done by creating language specific user roles?

    Thank you,
    Leon Williams
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 Sep 2016
    26 Apr 2010
    Link to this post
    Hi Leon Williams,

    There are not permissions per language. You could try the following

    1. Create roles based on the culture and the content that these roles will edit.
    2. In OnPreRender of Sitefinity\Admin\Admin.master.cs set the culture for each role explicitly

    protected override void OnPreRender(EventArgs e)
       {
           base.OnPreRender(e);
     
           if(UserManager.IsCurrentUserInRole("EsTranslator"))
           {
             Thread.CurrentThread.CurrentUICulture = new CultureInfo("es");
                 this.LangBar.Visible = false;
           }
           if (UserManager.IsCurrentUserInRole("EnTranslator"))
           {
               Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
                    this.LangBar.Visible = false;
           }
     
       }

    exclude the administrators role, so that an admin will be able to use all features.

    3. Hide the LanguageBar for the backend as shown in the code above - this.LangBar.Visible = false; This will prevent the user from switching the language.


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Leon Williams
    Leon Williams avatar
    20 posts
    Registered:
    18 Mar 2010
    26 Apr 2010
    Link to this post
    Thanks, I will try this.

    Leon
  4. Chris
    Chris avatar
    12 posts
    Registered:
    10 Aug 2010
    01 Mar 2013 in reply to Ivan Dimitrov
    Link to this post

    We ran across this and would like to accomplish something similar in version 5.2. Since the \sitefinity\admin\admin.master.cs file no longer exists how would we go about extending SiteFinity to attempt this or would it be a different method entirely now?

    I've read this post but I'm not clear where to find the info on extending SiteFinity's admin functionality in the documentation. Perhaps someone can point me in the right direction?

    Am I correct in assuming that permissions by culture is still not available in SiteFinity?

    Thanks in advance

  5. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    06 Mar 2013
    Link to this post
    Hi Chris,

    Currently we do not have out - of the - box functionality in Sitefinity 5.x which will limit the access to the frontend or the backend to a specific culture. For the frontend however, you can perform a redirect to language specific version of the website ( domain based ) based on the users culture.

    protected void Application_BeginRequest(object sender, EventArgs e)
            {
                string browserLanguage = HttpContext.Current.Request.UserLanguages[0];
         
                if (browserLanguage == "bg-BG")
                {
                    Response.Redirect("http://bg.mysite.com");
                }
            }


    Kind regards,
    Victor Velev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Matt Licht
    Matt Licht avatar
    5 posts
    Registered:
    01 Aug 2012
    15 Mar 2013 in reply to Chris
    Link to this post
    Hi Chris,
    Do you still need help with this?  If so, I can offer you some suggestions.
  7. Chanan Zass
    Chanan Zass avatar
    123 posts
    Registered:
    21 Aug 2012
    22 May 2013 in reply to Matt Licht
    Link to this post
    We  enter the following in global.asax:

    protected void Session_Start(object sender, EventArgs e)
            {
                String defLang = "en";
                if (Request.UserLanguages != null)
                {
                    if (Request.UserLanguages[0] != null)
                    {
                        String cult = Request.UserLanguages[0].ToString().ToLower().Substring(0, 2);
                        var langs = Telerik.Sitefinity.Abstractions.AppSettings.CurrentSettings.DefinedFrontendLanguages;
                        foreach (System.Globalization.CultureInfo lang in langs)
                        {
                            if (lang.Name.ToString().ToLower().Substring(0, 2) == cult)
                            {
                                defLang = cult;
                                break;
                            }
                        }
                    }
                }
                if (defLang != "en" && Request.Url.LocalPath.ToString().IndexOf(defLang + "/") == -1)
                {
                    Response.Redirect("http://" + Request.Url.Host + "/" + defLang + "/Default.aspx");
                }
            }

  8. Angel
    Angel avatar
    6 posts
    Registered:
    01 Apr 2013
    07 Mar 2014
    Link to this post

    Hello Telerik Team,

    Our company also needs this functionality out of the box, are you guys planning to support or currently supporting this?

     Thanks

     Angel

  9. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    28 Sep 2016
    13 Mar 2014
    Link to this post
    Hello,

    Currently we do not provide this functionality out of the box. I have logged it in our system as a feature request and hopefully will be able to implement it for our future releases. 

    Here is the link to our feedback portal where you can track its progress and vote to increase its popularity.

    Regards,
    Sabrie Nedzhip
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
Register for webinar
9 posts, 0 answered