PageSourceSearch

https://rekrutacja.pedagogium.pl/pdg-irk-app/content/script/irk/se…/authentication/authenticationService.js

js pedagogium.pl collected 2026-10-04 13:35:14 UTC 1,276 bytes, 50 lines download raw bytes

1angular.module('irk').factory('AuthService', function ($http, $q, Session) {
2	  var authService = {};
3	  authService.logout = function (deepCheck) {
4		  var params = {};
5		  if(deepCheck !== 'undefined') {
6			  params.deepCheck = deepCheck;
7		  }
8		    return $http
9		      .post('REST/logout', params)
10		      .then(function (res) {
11		    	  if(res.data) {
12		    		  return res.data;
13		    	  }
14		    	  else {
15		    		  return $q.reject(res.data);
16		    	  }
17		      });
18		  };
19	  authService.logoutPermission = function () {
20		  return authService.logout(true);
21	  };
22	  
23	  authService.login = function (daneLogowania) {
24	    return $http
25	      .post('REST/login', daneLogowania)
26	      .then(function (res) {
27	    	  if(res.data == 'SUKCES') {
28	    		  return res.data;
29	    	  }
30	    	  else {
31	    		  return $q.reject(res.data);
32	    	  }
33	      });
34		  return defer.promise;
35	  };
36	 
37	  authService.isAuthenticated = function () {
38	    return !!Session.userId;
39	  };
40	 
41	  authService.isAuthorized = function (authorizedRoles) {
42	    if (!angular.isArray(authorizedRoles)) {
43	      authorizedRoles = [authorizedRoles];
44	    }
45	    return (authService.isAuthenticated() &&
46	      authorizedRoles.indexOf(Session.userRole) !== -1);
47	  };
48	 
49	  return authService;
50	});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.