wiki helper stuff
This commit is contained in:
@@ -88,8 +88,10 @@ class WikiController extends Controller
|
|||||||
|
|
||||||
if(Auth::user()->hasRole('User')) {
|
if(Auth::user()->hasRole('User')) {
|
||||||
$role = 1; //User role id from wiki_groupname table
|
$role = 1; //User role id from wiki_groupname table
|
||||||
|
$roleDescription = 'user';
|
||||||
} else if(Auth::user()->hasRole('Renter')) {
|
} else if(Auth::user()->hasRole('Renter')) {
|
||||||
$role = 8; //Renter role id from wiki_groupname table
|
$role = 8; //Renter role id from wiki_groupname table
|
||||||
|
$roleDescription = 'renter';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load the model
|
//Load the model
|
||||||
@@ -111,6 +113,7 @@ class WikiController extends Controller
|
|||||||
$uid = DB::select('SELECT id FROM wiki_user WHERE login = ?', [$name]);
|
$uid = DB::select('SELECT id FROM wiki_user WHERE login = ?', [$name]);
|
||||||
$member->uid = $uid[0]->id;
|
$member->uid = $uid[0]->id;
|
||||||
$member->gid = $role;
|
$member->gid = $role;
|
||||||
|
$member->groupname = $roleDescription;
|
||||||
$member->save();
|
$member->save();
|
||||||
//Return to the dashboard view
|
//Return to the dashboard view
|
||||||
return redirect('/dashboard')->with('success', 'Registration successful. Your username is: ' . $name);
|
return redirect('/dashboard')->with('success', 'Registration successful. Your username is: ' . $name);
|
||||||
@@ -162,37 +165,6 @@ class WikiController extends Controller
|
|||||||
return view('wiki.displayaddug');
|
return view('wiki.displayaddug');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores the modifications to the user to add to a group to give permissions
|
|
||||||
*
|
|
||||||
* @param uid
|
|
||||||
* @param gid
|
|
||||||
* @param gname
|
|
||||||
*/
|
|
||||||
public function storeAddUserToGroup($uid, $gid, $gname) {
|
|
||||||
|
|
||||||
return redirect('/dashboard')->with('success', 'User added to the group: ' . $gid . ' with name of ' . $gname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the modify user group page
|
|
||||||
*/
|
|
||||||
public function displayModifyWikiUser() {
|
|
||||||
$this->middleware('role:Admin');
|
|
||||||
|
|
||||||
return view('wiki.display.modifyuser');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Modify the user's group(s) in the database for the wiki
|
|
||||||
*/
|
|
||||||
public function modifyWikiUser(Request $request) {
|
|
||||||
$this->validate($request, [
|
|
||||||
'user' => 'required',
|
|
||||||
'group' => 'required',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function DeleteWikiUser($user) {
|
private function DeleteWikiUser($user) {
|
||||||
//Get the uid of the user as we will need to purge them from the member table as well.
|
//Get the uid of the user as we will need to purge them from the member table as well.
|
||||||
//the member table holds their permissions.
|
//the member table holds their permissions.
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class WikiHelper {
|
|||||||
DokuMember::insert([
|
DokuMember::insert([
|
||||||
'uid' => $user->id,
|
'uid' => $user->id,
|
||||||
'gid' => $newGroup->id,
|
'gid' => $newGroup->id,
|
||||||
|
'groupname' => $newGroup->gname,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//Return true saying we have inserted the user into the group
|
//Return true saying we have inserted the user into the group
|
||||||
|
|||||||
Reference in New Issue
Block a user