Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apphook permission is not working on Apache with non-root url #4385

Closed
pigsign opened this issue Aug 27, 2015 · 7 comments
Closed

Apphook permission is not working on Apache with non-root url #4385

pigsign opened this issue Aug 27, 2015 · 7 comments

Comments

@pigsign
Copy link

pigsign commented Aug 27, 2015

My environment is:

  • Django 1.8
  • Django-CMS 3.1.2
  • Python 2.7.5
  • cms_app.py
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool

class PwdGeneratorApp(CMSApp):
    name = _("Password Generator App")
    urls = ["pwd_generator.urls"]
    app_name = "PwdGenerator"
    permissions = True

apphook_pool.register(PwdGeneratorApp)
  • view.py
# coding=utf-8

from django.shortcuts import render
from cms.utils.decorators import cms_perms

@cms_perms
def index(request):
    context_dict = {}
    return render(request, 'pwd_generator_index.html', context_dict)
  1. I create a page and check "login_require" on, then attach the apphook to page. But guest still can see this page without log in.
  2. Top tool menu's "Page" function button is disappear.
@evildmp
Copy link
Contributor

evildmp commented Sep 17, 2015

@pigsign Have you restarted the Django instance after attaching the apphook?

@pigsign
Copy link
Author

pigsign commented Sep 21, 2015

@evildmp Yes, I did - try to restart Apache service and reboot server.
Sorry, more environment info list below:

  • Django CMS running on Apache.
  • templates/pwd_generator_base.html
{% extends CMS_TEMPLATE %}
{% load cms_tags %}
{% block content %}
{% endblock content %}
  • templates/pwd_generator_index.html
{% extends "pwd_generator_base.html" %}

{% block title %}
pwd generator
{% endblock %}

{% block content %}
<br />
<br />
<div class="container">
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <div class="well">
                <form class="form-inline" role="form" action="{% url 'PwdGenerator:index' %}" method="post">
                    {% csrf_token %}
                    <div class="form-group" align="center">
                        <div class="input-group input-group-lg">
                            <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                            <input class="form-control" name="idName" type="text" placeholder="id" size="40" required />
                        </div>
                        <button class="btn btn-info btn-lg" type="submit">ok</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

{% endblock %}

2015-09-21 4_05_45

@yakky yakky added this to the 3.1.x milestone Sep 26, 2015
@yakky
Copy link
Member

yakky commented Sep 26, 2015

@pigsign does this happen on runserver deployment too?

@pigsign
Copy link
Author

pigsign commented Sep 29, 2015

@yakky thanks for your mention, it works well on runserver deployment.
so problem is my Apache config or AppHooks permission is not compatible for Apache???

my Apache conf:

WSGIDaemonProcess portal18 python-path=/share/django-cms-18:/share/virtualenv/cms_31_dj_18/lib/python2.7/site-packages
WSGIScriptAlias /portal18 /share/django-cms-18/portal/wsgi.py process-group=portal18 application-group=%{GLOBAL}
WSGIProcessGroup p18.dodotest.com
WSGISocketPrefix /var/run/wsgi18

<Directory /share/django-cms-18/portal>
        <Files wsgi.py>
                <IfVersion < 2.3 >
                         Order allow,deny
                        Allow from all
                </IfVersion>
                <IfVersion >= 2.3>
                        Require all granted
                </IfVersion>
        </Files>
</Directory>


######################
# Django static file
######################
Alias /static18/ /share/django-cms-18/static/

<Directory /share/django-cms-18/static>
    Require all granted
</Directory>

Thanks for your kindly help!!!!~

@pigsign pigsign changed the title Apphook permission still not working Apphook permission is not working on Apache with non-root url Oct 8, 2015
@pigsign
Copy link
Author

pigsign commented Oct 8, 2015

I do deep test, find apphook permission work well if Apache httpd.conf using root url.

WSGIScriptAlias / /share/django-cms-18/portal/wsgi.py

apphook permission is not working if Apache httpd.conf using non-root url.

WSGIScriptAlias /portal18 /share/django-cms-18/portal/wsgi.py

Btw, Django-cms origin permission works well on root or non-root url Apache environment.

@yakky yakky modified the milestones: 3.1.x, Clean up issues & pull requests Jan 24, 2016
@czpython czpython self-assigned this Jun 13, 2016
@czpython
Copy link
Contributor

Hello @pigsign,
We overhauled the permissions system on 3.4, would you be able to test if this issue still occurs using latest 3.4.x version?

@czpython
Copy link
Contributor

Closing due to inactivity.
Feel free to open a new ticket if this issue is still reproducible on the latest cms (3.4.x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants