Module Expr Str Assign NameStore Str ImportFrom alias identifier Import alias ImportFrom alias ImportFrom alias identifier ImportFrom alias ImportFrom alias ImportFrom alias identifier ImportFrom alias identifier Assign NameStore Call AttributeLoad NameLoad attr Str ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr keyword Call AttributeLoad NameLoad attr keyword Str keyword Str keyword NameLoad keyword NameLoad keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr keyword Str keyword AttributeLoad NameLoad attr keyword Dict Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr keyword Str keyword AttributeLoad NameLoad attr keyword Dict Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr keyword Str keyword AttributeLoad NameLoad attr keyword Dict Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr keyword Str keyword AttributeLoad NameLoad attr keyword Dict Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr keyword Str keyword AttributeLoad NameLoad attr keyword Dict Str AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body Expr Str Assign NameStore Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str keyword Num Assign NameStore Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr keyword NameLoad keyword Str keyword Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr keyword Num attr decorator_list Assign NameStore Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Str If BoolOpAnd UnaryOpNot NameLoad UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad If CompareIs NameLoad NameLoad body Raise Call NameLoad BinOpAdd BinOpAdd Str NameLoad Str orelse Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Return TupleLoad NameLoad NameLoad decorator_list
N/A N/A 
   Copyright 2013, 2014 Ricardo Tubio-Pardavila

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 N/A __author__ rtubiopa@calpoly.edu allauth.account adapter allauth_adapter N/A logging django.db models django.contrib.auth models auth_models django.shortcuts get_object_or_404 django_countries.fields CountryField services.accounts utils account_utils website settings satnet_settings N/A logger N/A N/A logging getLogger accounts UserProfileManager N/A N/A models Manager N/A N/A 
    Custom manager that implements a set of function to perform basic tasks
    over the users and profiles of this extended model.
     create_anonymous N/A N/A self N/A N/A N/A Create manager method
        Creates a profile for an anonymous user.
        :return: Reference to the just-created profile
         N/A profile N/A N/A self create username N/A N/A account_utils generate_random_username first_name Anonymous last_name User is_active True anonymous True country US organization SATNET N/A N/A N/A profile set_unusable_password N/A N/A N/A profile save N/A profile N/A verify_user N/A N/A self user_id N/A N/A N/A 
        Function that changes user status to 'verified' in the database.
        
        :parameter user_id:
            Identifier of the user
        :type user_id:
            int
        :returns:
            None
         N/A user N/A get_object_or_404 UserProfile user_ptr user_id N/A N/A user is_verified True N/A N/A N/A user save N/A N/A N/A N/A N/A allauth_adapter get_adapter send_mail template_prefix email/email_user_activated email N/A user email context N/A user_email N/A user email N/A block_user N/A N/A self user_id N/A N/A N/A 
        Function that changes user status to 'blocked' in the database.
        
        :parameter user_id:
            Identifier of the user
        :type user_id:
            int
        :returns:
            None
         N/A user N/A get_object_or_404 UserProfile user_ptr user_id N/A N/A user blocked True N/A N/A N/A user save N/A N/A N/A N/A N/A allauth_adapter get_adapter send_mail template_prefix email/email_user_blocked email N/A user email context N/A user_email N/A user email N/A unblock_user N/A N/A self user_id N/A N/A N/A 
        Function that changes user status to 'unblocked' in the database.
        
        :parameter user_id:
            Identifier of the user
        :type user_id:
            int
        :returns:
            None
         N/A user N/A get_object_or_404 UserProfile user_ptr user_id N/A N/A user blocked False N/A N/A N/A user save N/A N/A N/A N/A N/A allauth_adapter get_adapter send_mail template_prefix email/email_user_activated email N/A user email context N/A user_email N/A user email N/A activate_user N/A N/A self user_id N/A N/A N/A 
        Function that changes user status to 'active' in the database.
        
        :parameter user_id:
            Identifier of the user
        :type user_id:
            int
        :returns:
            None
         N/A user N/A get_object_or_404 UserProfile user_ptr user_id N/A N/A user is_active True N/A N/A N/A user save N/A N/A N/A N/A N/A allauth_adapter get_adapter send_mail template_prefix email/email_user_activated email N/A user email context N/A user_email N/A user email N/A deactivate_user N/A N/A self user_id N/A N/A N/A 
        Function that changes user status to 'active' in the database.
        
        :parameter user_id:
            Identifier of the user
        :type user_id:
            int
        :returns:
            None
         N/A user N/A get_object_or_404 UserProfile user_ptr user_id N/A N/A user is_active False N/A N/A N/A user save N/A N/A N/A N/A N/A allauth_adapter get_adapter send_mail template_prefix email/email_user_blocked email N/A user email context N/A user_email N/A user email N/A N/A UserProfile N/A N/A auth_models User N/A N/A 
    This class holds additional data required from each user. It is used in 
    accordance with the process for extending the User model from 
    django.contrib.auth, in accordance with Django's website.
     N/A objects N/A UserProfileManager N/A organization N/A N/A models CharField Name of the organization that the user belongs to max_length 100 N/A country N/A CountryField N/A is_verified N/A N/A models BooleanField Flag that sets this user profile as verified default False N/A blocked N/A N/A models BooleanField Flat that sets this user profile as blocked default False N/A anonymous N/A N/A models BooleanField Flag that sets this user as an anonymous user default False N/A create_admin_profile N/A N/A apps schema_editor N/A N/A N/A Data migrations
    This method creates the profile for the initial administrator user added
    by default by django manage.py.

    :param apps: Not used variable
    :param schema_editor: Not used variable
     N/A N/A N/A N/A UserProfile objects create user_ptr N/A N/A N/A N/A auth_models User objects get is_superuser True organization The SATNet Network country US N/A remove_admin_profile N/A N/A apps schema_editor N/A N/A N/A Data migrations
    Reverse data migration that destroys the user profile initially created
    for the administrator.

    :param apps: Not used variable
    :param schema_editor: Not used variable
     N/A N/A N/A N/A N/A N/A UserProfile objects get pk 1 delete N/A N/A PERMISSION_EX_MSG No HTTP request: using testing identity. get_user N/A N/A http_request permissions_flag test_username testing_flag N/A None N/A satnet_settings JRPC_PERMISSIONS N/A satnet_settings TEST_USERNAME N/A satnet_settings TESTING N/A N/A 
    Returns the username of the user within a given HTTP request object. It
    takes into account all the permission policies implemented by the server.

    #### TODO # For some reason, the user object returned is a
    <SimpleLazyObject> that cannot be directly assigned as the owner of any
    segment and, within the create method for Spacecraft and Ground Station,
    they duplicate half the functionality of this method here.

    :param http_request: The HTTP request object
    :param permissions_flag: Flag with whether the permissions should be used
    :param test_username: Flag with the test username
    :param testing_flag: Flag indicating the testing condition
    :return: (user, username) Tuple with the user object as per django_auth
        contrib library and its username separate
     N/A N/A N/A permissions_flag N/A testing_flag N/A N/A N/A N/A logger warn PERMISSION_EX_MSG N/A username test_username N/A user N/A N/A N/A UserProfile objects get username username N/A N/A user None N/A N/A N/A Exception N/A N/A User < username > could not be found. N/A N/A user N/A http_request user N/A username N/A user username N/A N/A user username N/A