<commit_before>/*
 * Copyright (c) 2014 Inocybe Technologies, and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

define([], function () {
  'use strict';

  var Auth = function ($http, $window, Base64, ENV) {
    var factory = {};
    // Set Authorization header to username + password
    factory.setBasic = function (user, pw) {
      $window.sessionStorage.odlUser = user;
      $window.sessionStorage.odlPass = pw;
    };

    factory.unsetBasic = function () {
      if ($http.defaults.headers.common.Authorization !== null) {
        delete $http.defaults.headers.common.Authorization;
      }
      delete $window.sessionStorage.odlUser;
      delete $window.sessionStorage.odlPass;
              document.cookie = 'JSESSIONID=; Path=/restconf; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
    };

    // Return the current user object
    factory.getUser = function () {
      var user = $window.sessionStorage.odlUser || null;
      return user;
    };

    factory.authorize = function (accessLevel, role) {
      if (role === undefined) {
        role = currentUser.role;<commit_msg>clear all sessionStorage on Logout<commit_after>/*
 * Copyright (c) 2014 Inocybe Technologies, and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

define([], function () {
  'use strict';

  var Auth = function ($http, $window, Base64, ENV) {
    var factory = {};
    // Set Authorization header to username + password
    factory.setBasic = function (user, pw) {
      $window.sessionStorage.odlUser = user;
      $window.sessionStorage.odlPass = pw;
    };

    factory.unsetBasic = function () {
      if ($http.defaults.headers.common.Authorization !== null) {
        delete $http.defaults.headers.common.Authorization;
      }
      $window.sessionStorage.clear();
      document.cookie = 'JSESSIONID=; Path=/restconf; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
    };

    // Return the current user object
    factory.getUser = function () {
      var user = $window.sessionStorage.odlUser || null;
      return user;
    };

    factory.authorize = function (accessLevel, role) {
      if (role === undefined) {
        role = currentUser.role;
{'fraction_non_alphanumeric': 0.11764705882352941, 'fraction_numerical': 0.017140631086871836, 'mean_word_length': 3.0125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7254674', 'n_tokens_mistral': 775, 'n_tokens_neox': 725, 'n_words': 214}