Skip to content

Commit

Permalink
Merge pull request #1053 from TOMToolkit/633-explain-the-role-of-the-…
Browse files Browse the repository at this point in the history
…anonymous-user

update docs with a brief description of AnonymousUser
  • Loading branch information
jchate6 authored Oct 23, 2024
2 parents 61ab0d9 + b1ff47a commit 336a91a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
2 changes: 2 additions & 0 deletions docs/common/customsettings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ documentation on `Adding Custom Fields to
Targets </targets/target_fields>`__ for an explanation of how to use
this feature.

.. _custom_facility_settings:

`FACILITIES <#facilities>`__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
21 changes: 15 additions & 6 deletions docs/common/permissions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,28 @@ The Permissions System
======================

The permissions system is built on top of
`django-guardian <https://django-guardian.readthedocs.io/en/stable/>`_. It has been
`django-guardian <https://django-guardian.readthedocs.io/en/stable/>`__. It has been
kept as simple as possible, but TOM developers may extend the capabilities if
needed.

The TOM Toolkit provides a permissions system that can be used in two different modes. The mode is controlled by the
``TARGET_PERMISSIONS_ONLY`` boolean in ``settings.py``.


`AnonymousUser`
---------------

When you first establish your TOM, ``django-guardian`` will create an ``AnonymousUser`` as the default user for the
TOM. ``AnonymousUser`` is a special user that is used to represent users who are not logged in and only has permission
to see targets that are associated with the ``public`` group by default. This user is important for establishing what
permissions are available to users who are not logged in and should not be removed. You can modify the permissions of
``AnonymousUser`` by using the Django admin interface or the methods described below.

*Note:* This ``AnonymousUser`` is not the same as the ``AnonymousUser`` object that is part of
`Django's authentication system. <https://docs.djangoproject.com/en/5.1/ref/contrib/auth/#anonymoususer-object>`__



First Mode -- Permissions on Targets and Observation Records
------------------------------------------------------------

Expand All @@ -25,18 +39,13 @@ button found at the top of the groups table:

.. image:: /_static/permissions_doc/addgroup.png

![](/_static/permissions_doc/addgroup.png)

Modifying a group will allow you to change it's name and add/remove users.

When a user adds or modifies a target, they are able to choose the groups to
assign to the target:

.. image:: /_static/permissions_doc/targetgroups.png

![](/_static/permissions_doc/targetgroups.png)


By default the target will be assigned to all groups the user belongs to.

There is a special group, "Public". By default, all users belong to the Public
Expand Down
13 changes: 8 additions & 5 deletions docs/introduction/faqs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ I try to observe a target with LCO but get an error.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You might not have added your LCO api key to your settings file under
the ``FACILITIES`` settings. See :doc:`Custom
Settings </common/customsettings#facilities>` for more
the ``FACILITIES`` settings. See :ref:`Custom
Settings <custom_facility_settings>` for more
details.

How do I create a super user (PI)?
Expand Down Expand Up @@ -103,12 +103,15 @@ This will make the contents of ``newpage.html`` available under the path
Who is AnonymousUser?
~~~~~~~~~~~~~~~~~~~~~

AnonymousUser is a special profile that django-guardian, our permissions
`AnonymousUser` is a special profile that django-guardian, our permissions
library, creates automatically. AnonymousUser represents an
unauthenticated user. The user has no first name, last name, or
password, and allows unauthenticated users to view unprotected pages
within your TOM. You can choose to delete the user if you don’t want any
pages to be visible without logging in.
within your TOM. Do not delete this user, as then an unauthorized user will not
have access to the login page.

*Note:* This ``AnonymousUser`` is not the same as the ``AnonymousUser`` object that is part of
`Django's authentication system. <https://docs.djangoproject.com/en/5.1/ref/contrib/auth/#anonymoususer-object>`_

How can I display an error message when authentication to an external facility fails?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 336a91a

Please sign in to comment.