Changed change_access to use id instead of event, Added check to see if updated is needed on user table access column.

This commit is contained in:
xevidos 2020-02-26 09:20:51 -05:00
parent fee5d1e869
commit 271a10abd3
3 changed files with 18 additions and 4 deletions

View File

@ -292,7 +292,7 @@ switch( $_GET['action'] ) {
<p><?php echo htmlentities( $i["username"] );?></p>
</td>
<td>
<select onchange="codiad.project.change_access( event );">
<select onchange="codiad.project.change_access( <?php echo $i["id"];?> );">
<?php
foreach( Permissions::LEVELS as $level => $id ) {

View File

@ -69,10 +69,9 @@
});
},
change_access: function( e ) {
change_access: function( id ) {
let _this = codiad.project;
let id = $( '#modal-content form select[name="user_list"]' ).val();
let project_path = $( '#modal-content form input[name="project_path"]' ).val();
let project_id = $( '#modal-content form input[name="project_id"]' ).val();
let access = $( e.target ).children( "option:selected" ).val();

View File

@ -281,6 +281,21 @@ class sql {
$update_query = "";
$users = $this->query( "SELECT id, access FROM users", array(), array(), "fetchAll", "exception" );
$update = false;
foreach( $users as $row => $user ) {
if( ! is_numeric( $user["access"] ) ) {
$update = true;
break;
}
}
if( ! $update ) {
$users = array();
}
foreach( $users as $row => $user ) {
@ -289,7 +304,7 @@ class sql {
$access = Permissions::SYSTEM_LEVELS[$user["access"]];
} elseif( is_numeric( $user["access"] ) ) {
continue;
$access = $user["access"];
} else {
$access = Permissions::SYSTEM_LEVELS["user"];