Wagtail: how to restrict all pages to logged in users only - wagtail

I am using Wagtail for an internal knowledge base. I would like all pages to default to 'Accessible to logged in users'.
This is possible on a page-by-page basis using the 'privacy' setting: http://docs.wagtail.io/en/v1.8.1/advanced_topics/privacy.html
How can I make this the default for all pages?

The privacy settings are inherited by all child pages so if you make your Homepage accessible to logged in users then all its children (i.e all pages) will also have the same privacy setting! Notice that by "Homepage" I mean the root page of your wagtail tree ie the first page that you see to its right after you click "Explorer" in wagtail admin (on single site wagtail setups).

Related

Page Type showing "Home page" or "page" randomly

I followed Official Wagtail Docs to integrate freshly installed Wagtail into existing Django project.
I added customized HomePage class in existing Django's models.py.
# myDjangoProject/models.py
class HomePage(Page):
template = "homepage.html"
content = RichTextField()
content_panels = Page.content_panels + [
FieldPanel("content")
]
Q1: In above screenshot, Why system default page Welcome to Wagtail is of Page TYPE, while newly created New Page is of Home page TYPE automatically ?
Q2: In above screenshot, Why Newly-created child page under system default page Welcome to Wagtail is of Home page surprisingly without any manual configuration ?
Q3: In above screenshot, why all newly-created pages automatically (no manual configuration required) inherited from my customized HomePage class in MyDjangoProject/models.py ? How is this reflected on source code level ?
The Page class is the base class of all page types in Wagtail, but normally it wouldn't be desirable to let users create pages that are of the type Page rather than something more specific, because there's no way to add new content fields to it. For this reason, the is_creatable attribute is set to false on Page, which means that new pages of that type can't be created through the admin interface. (This attribute is not inherited by subclasses, so any new page types you create will be is_creatable = True by default.)
The initial "Welcome" page is created as part of the migrations in the wagtail.core app. At this point, Page is the only page type that exists (since your HomePage model hasn't been defined yet), so that's the one Wagtail uses. It might seem a bit weird that the default page is not one that you can create yourself through the admin, but there's no real alternative (other than not providing a default page at all, which would make it harder for developers to see if their installation has worked).
(When setting up a brand new Wagtail project through wagtail start, the project template includes migrations to replace the initial Page instance with an instance of the supplied HomePage model, so in this case it's less confusing.)
After you defined your HomePage model, this became the only page type with is_creatable = True, and so the admin interface automatically selects this page type on adding a new page. When you add another page model alongside HomePage, you'll find that it prompts you to select a page type.

CMS user cannot see "add child page" button

I am trying to use Wagtail within a pre-existing Django project. I have installed the CMS, and it seems to be working well within the existing Django admin - I can authenticate using one of Django admin's users and see the CMS UI, all good.
But: No matter what I try, as an admin user, I cannot see the "Add Child Page" button at the URL of the page e.g /cms/pages/3/. The "Add Child Page" lozenge icon does not show. This is a bit of a pain, because all tutorials and examples assume that this icon is already showing!
The user I am logged-in as is set as "is_superuser" = 't' in auth_user, and one of the two groups the user is in, has been granted ALL wagtail permissions within Django admin (I was desperate!), but still no dice. I've also tried giving ALL perms to other (non-admin) users, and logging-in as them, but still cannot see the button.
I have created a basic HomePage that subclasses Page and I still see no way to create one. delving deeper, I see that one of the user's groups (auth_group.id=1) has the "add" permission in "wagtailcore_grouppagepermission" for the page I am viewing in the CMS which appears correct.
I am new to Python/Django, so I may have missed something obvious!
Django 2.2
Wagtail 2.8.1
CentOS
Python 3.6
(Docker multi-service setup through docker-compose using CentOS)
[UPDATE]
I can see that the following line is failing the test for specific_class being anything other than None. If I hack the line to return True, I see the button in the CMS UI:
./core/models.py:
def can_add_subpage(self):
...
if specific_class is None or not specific_class.creatable_subpage_models():
print('##', specific_class) # None
return False
...
Why would specific_class be None? What exactly is specific_class?
Take a look at the subpage_types declaration: https://docs.wagtail.io/en/latest/reference/pages/model_reference.html?highlight=parent_page#wagtail.core.models.Page.subpage_types
Also see parent_page_types below that.

Wagtail: how to change the default root and/or home page

How do I create my custom home page at the root level for my site?
I'm integrating wagtail to my django project. As documented I try to plug my custom homepage model and create a new site record
... You’ll probably want to replace this with your own HomePage class -
when you do so, ensure that you set up a site record (under Settings /
Sites in the Wagtail admin) to point to the new homepage.
When I try to update my site's root settings, page explorer doesn't list my custom home page. And I'm unable to create a page from my model at the root level. When I delete the existing root page, then I'm totally stuck.
Any guidance will be appreciated. Thanks.
Update (resolved)
Thinking that my custom home page will be the root of my side, I had this setting parent_page_types = [] in my model. Removing it lets me add it as child to existing root, which I can point in my site as the root.
Note: This was answered in the question via an update, pasting below for future readers.
On the page model, setting parent_page_types = [] meant that this page could not be put under other pages. As the root page is also a page, it meant the home page could not be set correctly.
Removing it lets you it as child to existing root, which I can point in my site as the root.
Docs - Page.parent_page_types

Dot Net Nuke issue with new page visible to Admin Only in Nav

I have an issue with DotNetNuke where only the admin can see a new page I've added in the main navigation (the page appears in sidebar for all users)
After creating a new page with DotNetNuke, I can manually browse to the page, and all links to it work however it is only visible in the navigation menu when I'm logged in as administrator.
Manually going to the page works fine when not logged in. Include in Menu? is checked (and been toggled) and I've tried all variations of permissions I can think of (which apart from the navigation issue work exactly as I would expect).
I hope this is the correct format I'm still relatively new!
Sounds like you have the page settings set to admin only for view... navigate to the page click on pages>page settings. click on the permissions tab and make sure inherit page settings from parent page is unchecked. Then next to All Users, Registered Users, Subscriber,
Translator (en-US), Unauthenticated Users and Unverified Users make sure there is a green check mark in the view section. Then make sure that page is disabled in advanced settings is unchecked and include in menu in page settings is checked.... Hope this helps... If not try making a new page and copy all the modules from the old one and see if that works

how to set visual force page as default in salesforce

I have a requirement that there is a user with particular profile and if he logs into the salesforce account, I want that he should be directly shifted to a visual force page. I tried to replace home tab with visual force page. But in profile this option is not editable. What I can do to accomplish this.
You could create a new "app". Apps are pretty much just sets of tabs (with exception of special stuff such as Service Cloud Console). In app you can define that there should be no home page, instead your visualforce (as a tab) would be added and marked as default landing page. Then you'd share this app with his profile and revoke access to other apps?
People can still add/remove tabs they wish to see in each app though so somebody might override your configuration.

Resources