Gets the currently logged in users preferences

    :returns: json
545799
def get(request):
    
    res = Result()
    obj, created = UserPref.objects.get_or_create(user=request.user, defaults={'data': json.dumps(DefaultPrefs.copy())})

    data = obj.json()
    data['subscriptions'] = [_.json() for _ in GallerySubscription.objects.filter(user=request.user)]

    res.append(data)

    return JsonResponse(res.asDict())
870866
def GetConfiguredUsers(self):
    
    if os.path.exists(self.google_users_file):
      users = open(self.google_users_file).readlines()
    else:
      users = []
    return [user.strip() for user in users]
86838
def refresh_context(self):
        
        User = self.model('res.user')

        self.context = User.get_preferences(True)
        return self.context
1269533
def _get_user(self) -> Dict:
        

        if 'callback_query' in self._update:
            return self._update['callback_query']['from']
        elif 'inline_query' in self._update:
            return self._update['inline_query']['from']
        elif 'message' in self._update:
            return self._update['message']['from']
166768
def userinfo_json(request, user_id):
    
    data = {'first_name': '',
            'last_name': '',
            'email': '',
            'slug': '',
            'bio': '',
            'phone': '',
            'is_active': False}

    try:
        member = StaffMember.objects.get(pk=user_id)
        for key in data.keys():
            if hasattr(member, key):
                data[key] = getattr(member, key, '')

    except StaffMember.DoesNotExist:
        pass

    return HttpResponse(json.dumps(data),
                        mimetype='application/json')
1244100
def get_current_user(self):
        
        from google.appengine.api import users

        if _IS_DEVELOPMENT_SERVER:
            return users.get_current_user()
        else:
            from google.appengine.api import oauth

            try:
                user = oauth.get_current_user()
            except oauth.OAuthRequestError:
                user = users.get_current_user()
            return user
192368
def user(self):
        
        return self.users.get(self.contexts[self.current_context].get("user", ""), {})
60855
public String getPreferencesButton() {

        int buttonStyle = getSettings().getUserSettings().getWorkplaceButtonStyle();
        if (!getCms().getRequestContext().getCurrentUser().isManaged()) {
            return button(
                "../commons/preferences.jsp",
                "body",
                "preferences.png",
                Messages.GUI_BUTTON_PREFERENCES_0,
                buttonStyle);
        } else {
            return button(null, null, "preferences_in.png", Messages.GUI_BUTTON_PREFERENCES_0, buttonStyle);
        }
    }
945337
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'consumption_preference_category_id'
                  ) and self.consumption_preference_category_id is not None:
            _dict[
                'consumption_preference_category_id'] = self.consumption_preference_category_id
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'consumption_preferences'
                  ) and self.consumption_preferences is not None:
            _dict['consumption_preferences'] = [
                x._to_dict() for x in self.consumption_preferences
            ]
        return _dict
318034
def get_settings(self, *args, **kwargs):
        
        url = self.reddit_session.config['wiki_page_settings']
        url = url.format(subreddit=six.text_type(self.subreddit),
                         page=self.page)
        return self.reddit_session.request_json(url, *args, **kwargs)['data']
1111314
def read_preferences_file(self):
        
        user_data_dir = find_pmag_dir.find_user_data_dir("thellier_gui")
        if not user_data_dir:
            return {}
        if os.path.exists(user_data_dir):
            pref_file = os.path.join(user_data_dir, "thellier_gui_preferences.json")
            if os.path.exists(pref_file):
                with open(pref_file, "r") as pfile:
                    return json.load(pfile)
        return {}
701394
function getPreferences() {
        // It's senseless to look prefs up for the current file, instead look them up for
        // the current project (or globally)
        return {
            closeBelow  : prefs.get("below",  PreferencesManager.CURRENT_PROJECT),
            closeOthers : prefs.get("others", PreferencesManager.CURRENT_PROJECT),
            closeAbove  : prefs.get("above",  PreferencesManager.CURRENT_PROJECT)
        };
    }
402614
def to_dict(self):
        
        users = dict(users=list())
        for user in self:
            users['users'].append(user.to_dict())
        return users
779872
def _get_user_data(self):
        

        url = self.session.host + '/sessions/' + str(self.session.id) + '/visualizations/' + str(self.id) + '/settings/'
        r = requests.get(url)
        if r.status_code == 200:
            content = r.json()
        else:
            raise Exception('Error retrieving user data from server')

        return content
482373
def current_user(self):
        
        if not hasattr(self, '_serverInfo') or 'username' not in self._serverInfo:

            url = self._get_url('serverInfo')
            r = self._session.get(url, headers=self._options['headers'])

            r_json = json_loads(r)
            if 'x-ausername' in r.headers:
                r_json['username'] = r.headers['x-ausername']
            else:
                r_json['username'] = None
            self._serverInfo = r_json
            # del r_json['self']  # this isn't really an addressable resource
        return self._serverInfo['username']
798768
def _get_user(session, slug_or_user_id):
        
        user_json_items = session.fetch('users.get', user_ids=slug_or_user_id, fields=User.USER_FIELDS)
        return User.from_json(session, user_json_items[0])
2980
def GET(self, *args, **kwargs):
        
        if self.user_manager.session_logged_in():
            if not self.user_manager.session_username() and not self.__class__.__name__ == "ProfilePage":
                raise web.seeother("/preferences/profile")

            if not self.is_lti_page and self.user_manager.session_lti_info() is not None: #lti session
                self.user_manager.disconnect_user()
                return self.template_helper.get_renderer().auth(self.user_manager.get_auth_methods(), False)

            return self.GET_AUTH(*args, **kwargs)
        else:
            return self.template_helper.get_renderer().auth(self.user_manager.get_auth_methods(), False)