Kaydet (Commit) 9c084e1f authored tarafından mertcelen's avatar mertcelen

Ldap Active directory completed.

üst 3e29e555
......@@ -11,11 +11,11 @@ class PermissionManager
// Main Function of Middleware
public function handle($request, Closure $next)
{
// Ignore this middleware if user is not authenticated at all.
if(!\Auth::check()){
return $next($request);
}
$request->request->add(['user_id' => \Auth::id()]);
// Get User Permissions.
......@@ -54,6 +54,7 @@ class PermissionManager
}
// Process request if everything is ok.
return $next($request);
}
......
......@@ -4,25 +4,25 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "6981954ccca8023bfdb38fec9fcd2aed",
"content-hash": "f337588ae8806bc43998be9f152c9e2c",
"hash": "c16a7112371c955ef2f95280868bcaec",
"content-hash": "1d12e6f39d917ac37b3cbe195dffcf41",
"packages": [
{
"name": "barryvdh/laravel-ide-helper",
"version": "v2.5.2",
"version": "v2.5.3",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-ide-helper.git",
"reference": "981ff45b43e0cf808af0a5a5f40f6369e0e29499"
"reference": "3d7f1240896a075aa23b13f82dfcbe165dadeef2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/981ff45b43e0cf808af0a5a5f40f6369e0e29499",
"reference": "981ff45b43e0cf808af0a5a5f40f6369e0e29499",
"url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/3d7f1240896a075aa23b13f82dfcbe165dadeef2",
"reference": "3d7f1240896a075aa23b13f82dfcbe165dadeef2",
"shasum": ""
},
"require": {
"barryvdh/reflection-docblock": "^2.0.4",
"barryvdh/reflection-docblock": "^2.0.6",
"composer/composer": "^1.6",
"illuminate/console": "^5.5,<5.8",
"illuminate/filesystem": "^5.5,<5.8",
......@@ -79,7 +79,7 @@
"phpstorm",
"sublime"
],
"time": "2018-10-06 09:35:51"
"time": "2018-12-19 12:12:05"
},
{
"name": "barryvdh/reflection-docblock",
......@@ -1809,16 +1809,16 @@
},
{
"name": "nesbot/carbon",
"version": "1.36.1",
"version": "1.36.2",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983"
"reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/63da8cdf89d7a5efe43aabc794365f6e7b7b8983",
"reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9",
"reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9",
"shasum": ""
},
"require": {
......@@ -1863,7 +1863,7 @@
"datetime",
"time"
],
"time": "2018-11-22 18:23:02"
"time": "2018-12-28 10:07:33"
},
{
"name": "nexmo/client",
......@@ -1915,16 +1915,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.1.0",
"version": "v4.1.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "d0230c5c77a7e3cfa69446febf340978540958c0"
"reference": "8aae5b59b83bb4d0dbf07b0a835f2680a658f610"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/d0230c5c77a7e3cfa69446febf340978540958c0",
"reference": "d0230c5c77a7e3cfa69446febf340978540958c0",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8aae5b59b83bb4d0dbf07b0a835f2680a658f610",
"reference": "8aae5b59b83bb4d0dbf07b0a835f2680a658f610",
"shasum": ""
},
"require": {
......@@ -1962,7 +1962,7 @@
"parser",
"php"
],
"time": "2018-10-10 09:24:14"
"time": "2018-12-26 11:32:39"
},
{
"name": "opis/closure",
......@@ -3825,16 +3825,16 @@
},
{
"name": "vlucas/phpdotenv",
"version": "v2.5.1",
"version": "v2.5.2",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e"
"reference": "cfd5dc225767ca154853752abc93aeec040fcf36"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e",
"reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/cfd5dc225767ca154853752abc93aeec040fcf36",
"reference": "cfd5dc225767ca154853752abc93aeec040fcf36",
"shasum": ""
},
"require": {
......@@ -3871,7 +3871,7 @@
"env",
"environment"
],
"time": "2018-07-29 20:33:41"
"time": "2018-10-30 17:29:25"
},
{
"name": "zendframework/zend-diactoros",
......@@ -5777,20 +5777,21 @@
},
{
"name": "webmozart/assert",
"version": "1.3.0",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "0df1908962e7a3071564e857d86874dad1ef204a"
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a",
"reference": "0df1908962e7a3071564e857d86874dad1ef204a",
"url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9",
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
"php": "^5.3.3 || ^7.0",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
......@@ -5823,7 +5824,7 @@
"check",
"validate"
],
"time": "2018-01-29 19:49:41"
"time": "2018-12-25 11:19:39"
}
],
"aliases": [],
......
This diff is collapsed.
This diff is collapsed.
<?php
$ldap_connection = ldap_connect($server->ip_address);
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3);
$pass = "SambaPardus01";
try{
$result = ldap_bind($ldap_connection,"cn=admin,dc=ldap,dc=lab",$pass);
}catch (Exception $e){
echo $e->getMessage();
}
$search = ldap_search($ldap_connection, "dc=ldap,dc=lab" , "(objectclass=posixAccount)", ["dn"]);
$users = ldap_get_entries($ldap_connection, $search);
$mert = [];
for($i = 0 ; $i < $users["count"] ; $i++){
$user = $users[$i]["dn"];
$arr = explode(",", $user);
$arr = array_reverse($arr);
$current = [];
$tail = null;
$res = array();
$t = &$res;
foreach ($arr as $k) {
if (empty($t[$k])) {
if(!starts_with($k,"cn")){
$t[$k] = array();
}
$t = &$t[$k];
}
}
unset($t);
$mert = array_merge_recursive($mert,$res);
}
?>
<script src="{{asset('/js/treeview.min.js')}}"></script>
<link rel="stylesheet" href="{{asset('/css/tree.css')}}">
<div id="tree"></div>
<script>
let tree = new TreeView([
@include("__system__.folder",["files" => $mert])
], 'tree');
tree.on('select',function(e){
console.log(e);
});
</script>
\ No newline at end of file
@if($server->type == "windows" || $server->type == "windows_powershell")
@include('extensions.kullanıcılar.index_windows')
@else
@include('extensions.kullanıcılar.index_linux')
@endif
\ No newline at end of file
<?php
$ldap_connection = ldap_connect($server->ip_address);
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3);
$pass = "SambaPardus01";
try{
$result = ldap_bind($ldap_connection,"cn=admin,dc=ldap,dc=lab",$pass);
}catch (Exception $e){
echo $e->getMessage();
}
$search = ldap_search($ldap_connection, "dc=ldap,dc=lab" , "(objectclass=posixAccount)", ["dn"]);
$users = ldap_get_entries($ldap_connection, $search);
$mert = [];
$user_details = [];
for($i = 0 ; $i < $users["count"] ; $i++){
$user = $users[$i]["dn"];
$arr = explode(",", $user);
$arr = array_reverse($arr);
$current = [];
$tail = null;
$res = array();
$t = &$res;
foreach ($arr as $k) {
if (empty($t[$k])) {
if(!starts_with($k,"cn")){
$t[$k] = array();
}else{
$t[$k] = $k;
$search = ldap_search($ldap_connection, "dc=ldap,dc=lab", $k);
$attributes = ldap_get_entries($ldap_connection, $search)[0];
$user_details["cn=" . $attributes["cn"][0]]["uid"] = $attributes["uid"][0];
$user_details["cn=" . $attributes["cn"][0]]["uidnumber"] = $attributes["uidnumber"][0];
$user_details["cn=" . $attributes["cn"][0]]["homedirectory"] = $attributes["homedirectory"][0];
$user_details["cn=" . $attributes["cn"][0]]["gidnumber"] = $attributes["gidnumber"][0];
$user_details["cn=" . $attributes["cn"][0]]["cn"] = $attributes["cn"][0];
}
$t = &$t[$k];
}
}
unset($t);
$mert = array_merge_recursive($mert,$res);
}
?>
<script src="{{asset('/js/treeview.min.js')}}"></script>
<link rel="stylesheet" href="{{asset('/css/tree.css')}}">
<div class="container">
<div class="row">
<div class="col">
<div id="tree"></div>
</div>
<div class="col pt-3">
<table class="table">
<tbody>
<tr>
<td>UID</td>
<td id="uid"></td>
</tr>
<tr>
<td>UID Number</td>
<td id="uidnumber"></td>
</tr>
<tr>
<td>Home Directory</td>
<td id="homedirectory"></td>
</tr>
<tr>
<td>GID Number</td>
<td id="gidnumber"></td>
</tr>
<tr>
<td>CN</td>
<td id="cn"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script>
let tree = new TreeView([
@include("__system__.folder",["files" => $mert])
], 'tree');
tree.on('select',function(e){
let cn = e.data.name;
document.getElementById("uid").innerText = user_details[cn]["uid"];
document.getElementById("uidnumber").innerText = user_details[cn]["uidnumber"];
document.getElementById("homedirectory").innerText = user_details[cn]["homedirectory"];
document.getElementById("gidnumber").innerText = user_details[cn]["gidnumber"];
document.getElementById("cn").innerText = user_details[cn]["cn"];
});
let user_details = <?php echo json_encode($user_details) ?>;
</script>
\ No newline at end of file
<?php
$ldap_connection = ldap_connect($server->ip_address);
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, 0);
$pass = "SambaPardus01";
try{
$result = ldap_bind($ldap_connection,"administrator@win.lab",$pass);
}catch (Exception $e){
dd($e->getMessage());
}
$search = ldap_search($ldap_connection, "dc=win,dc=lab" , "(objectclass=person)");
$users = ldap_get_entries($ldap_connection, $search);
$mert = [];
$user_details = [];
for($i = 0 ; $i < $users["count"] ; $i++){
$user = $users[$i]["dn"];
$arr = explode(",", $user);
$arr = array_reverse($arr);
$res = array();
$t = &$res;
for($j = 0 ; $j < count($arr) ; $j++){
$k = $arr[$j];
if (empty($t[$k])) {
if($j != count($arr) -1 ){
$t[$k] = array();
}else{
$t[$k] = $k;
$search = ldap_search($ldap_connection, "dc=win,dc=lab", "(&(objectCategory=person)($k))",[
"cn" , "whencreated", "whenchanged", "name" ,"samaccountname"
]);
$attributes = ldap_get_entries($ldap_connection, $search);
if($attributes["count"] == 0){
$user_details[$k]["cn"] = $k;
$user_details[$k]["whencreated"] = "";
$user_details[$k]["whenchanged"] = "";
$user_details[$k]["name"] = "";
$user_details[$k]["samaccountname"] = "";
continue;
}
$user_details[$k]["cn"] = $attributes[0]["cn"][0];
$user_details[$k]["whencreated"] = $attributes[0]["whencreated"][0];
$user_details[$k]["whenchanged"] = $attributes[0]["whenchanged"][0];
$user_details[$k]["name"] = $attributes[0]["name"][0];
$user_details[$k]["samaccountname"] = $attributes[0]["samaccountname"][0];
}
$t = &$t[$k];
}
}
unset($t);
$mert = array_merge_recursive($mert,$res);
}
?>
<script src="{{asset('/js/treeview.min.js')}}"></script>
<link rel="stylesheet" href="{{asset('/css/tree.css')}}">
<div class="container">
<div class="row">
<div class="col">
<div id="tree"></div>
</div>
<div class="col pt-3">
<table class="table">
<tbody>
<tr>
<td>CN</td>
<td id="cn"></td>
</tr>
<tr>
<td>When Created</td>
<td id="whencreated"></td>
</tr>
<tr>
<td>When Changed</td>
<td id="whenchanged"></td>
</tr>
<tr>
<td>Name</td>
<td id="name"></td>
</tr>
<tr>
<td>SAM Account Name</td>
<td id="samaccountname"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script>
let tree = new TreeView([
@include("__system__.folder",["files" => $mert])
], 'tree');
tree.on('select',function(e){
let cn = e.data.name;
document.getElementById("cn").innerText = user_details[cn]["cn"];
document.getElementById("whencreated").innerText = user_details[cn]["whencreated"];
document.getElementById("whenchanged").innerText = user_details[cn]["whenchanged"];
document.getElementById("name").innerText = user_details[cn]["name"];
document.getElementById("samaccountname").innerText = user_details[cn]["samaccountname"];
});
let user_details = <?php echo json_encode($user_details) ?>;
</script>
\ No newline at end of file
......@@ -18,7 +18,7 @@
<tr onclick="location.href = location.href + '/{{$server->_id}}';" class="highlight">
<td>{{$server->name}}</td>
<td>{{$server->ip_address}}</td>
<td>{{$server->port}}</td>
<td>{{$server->control_port}}</td>
</tr>
@endforeach
</tbody>
......
......@@ -6,38 +6,42 @@
"title" => $server->name
])
<h5>Hostname : {{$hostname}}</h5>
<button class="btn btn-success" onclick="location.href = '/sunucular/';">{{__("Geri Dön")}}</button>
<button class="btn btn-outline-success" onclick="location.href = '/sunucular/';">{{__("Geri Dön")}}</button>
@include('modal-button',[
"class" => "btn-primary",
"class" => "btn-outline-primary",
"target_id" => "edit",
"text" => "Düzenle"
])
@include('modal-button',[
"class" => "btn-warning",
"class" => "btn-outline-warning",
"target_id" => "command",
"text" => "Komut Çalıştır"
])
@include('modal-button',[
"class" => "btn-secondary",
"class" => "btn-outline-secondary",
"target_id" => "install_extension",
"text" => "Servis Ekle"
])
@include('modal-button',[
"class" => "btn-info",
"class" => "btn-outline-info",
"target_id" => "change_network",
"text" => "Network"
])
@include('modal-button',[
"class" => "btn-primary",
"class" => "btn-outline-primary",
"target_id" => "change_hostname",
"text" => "Hostname"
])
@include('modal-button',[
"class" => "btn-warning",
"class" => "btn-outline-warning",
"target_id" => "file_upload",
"text" => "Dosya Yükle"
])<br><br>
])
<button class="btn btn-outline-success">
{{__("Terminal")}}
</button>
<br><br>
@if(count($services) > 0)
<h4>{{__("Servis Durumları")}}</h4>
@foreach($services as $service)
......@@ -56,7 +60,7 @@
</pre>
@include('modal-button',[
"class" => "btn-danger",
"class" => "btn-outline-danger",
"target_id" => "delete",
"text" => "Sunucuyu Sil"
])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment