diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index cd046319e5..c2ebaabcf8 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,4 +1,4 @@ -## Contributor Code of Conduct +# Contributor Code of Conduct As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. @@ -8,6 +8,8 @@ Examples of unacceptable behavior by participants include the use of sexual lang Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. +This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. + Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. -This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/) \ No newline at end of file +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.1.0, available at [http://contributor-covenant.org/version/1/1/0/](http://contributor-covenant.org/version/1/1/0/) diff --git a/app/controllers/admin/AssetsController.php b/app/controllers/admin/AssetsController.php index 38414b9e8f..9a085da4e8 100755 --- a/app/controllers/admin/AssetsController.php +++ b/app/controllers/admin/AssetsController.php @@ -54,9 +54,14 @@ class AssetsController extends AdminController public function getCreate($model_id = null) { + /* // Grab the dropdown list of models //$model_list = array('' => 'Select a Model') + Model::orderBy('name', 'asc')->lists('name'.' '. 'modelno', 'id'); + $model_list = Model::select(DB::raw('concat(manufacturers.name," ",name) as name, id'))->orderBy('name', 'asc')->with('manufacturer')->lists('name', 'id'); + //$model_list = array('' => Lang::get('general.select_model')); + */ + $model_list = array('' => Lang::get('general.select_model')) + DB::table('models') ->select(DB::raw('concat(name," / ",modelno) as name, id'))->orderBy('name', 'asc') ->orderBy('modelno', 'asc') diff --git a/app/controllers/admin/GroupsController.php b/app/controllers/admin/GroupsController.php index 00b5c59963..8f550b79f7 100755 --- a/app/controllers/admin/GroupsController.php +++ b/app/controllers/admin/GroupsController.php @@ -161,21 +161,27 @@ class GroupsController extends AdminController return Redirect::back()->withInput()->withErrors($validator); } - try { - // Update the group data - $group->name = Input::get('name'); - $group->permissions = Input::get('permissions'); + if (!Config::get('app.lock_passwords')) { - // Was the group updated? - if ($group->save()) { - // Redirect to the group page - return Redirect::route('update/group', $id)->with('success', Lang::get('admin/groups/message.success.update')); - } else { - // Redirect to the group page - return Redirect::route('update/group', $id)->with('error', Lang::get('admin/groups/message.error.update')); + try { + // Update the group data + $group->name = Input::get('name'); + $group->permissions = Input::get('permissions'); + + // Was the group updated? + if ($group->save()) { + // Redirect to the group page + return Redirect::route('update/group', $id)->with('success', Lang::get('admin/groups/message.success.update')); + } else { + // Redirect to the group page + return Redirect::route('update/group', $id)->with('error', Lang::get('admin/groups/message.error.update')); + } + } catch (NameRequiredException $e) { + $error = Lang::get('admin/group/message.group_name_required'); } - } catch (NameRequiredException $e) { - $error = Lang::get('admin/group/message.group_name_required'); + + } else { + return Redirect::route('update/group', $id)->withInput()->with('error', 'Denied! Editing groups is not allowed in the demo.'); } // Redirect to the group page diff --git a/app/controllers/admin/ModelsController.php b/app/controllers/admin/ModelsController.php index 8a8fcb7d4a..7e22d05b93 100755 --- a/app/controllers/admin/ModelsController.php +++ b/app/controllers/admin/ModelsController.php @@ -236,7 +236,7 @@ class ModelsController extends AdminController return Redirect::to('hardware/models')->with('success', Lang::get('admin/models/message.delete.success')); } } - + public function getRestore($modelId = null) { @@ -308,7 +308,7 @@ class ModelsController extends AdminController return $view; } - + public function getDatatable($status = null) { $models = Model::orderBy('created_at', 'DESC')->with('category','assets','depreciation'); @@ -324,6 +324,9 @@ class ModelsController extends AdminController }); return Datatable::collection($models) + ->addColumn('manufacturer', function($models) { + return $models->manufacturer->name; + }) ->addColumn('name', function ($models) { return link_to('/hardware/models/'.$models->id.'/view', $models->name); }) @@ -345,15 +348,15 @@ class ModelsController extends AdminController ->orderColumns('name','modelno','asset_count','depreciation','category','eol','actions') ->make(); } - - + + public function getDataView($modelID) { $model = Model::withTrashed()->find($modelID); $modelassets = $model->assets; - $actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function ($modelassets) - { + $actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function ($modelassets) + { if (($modelassets->assigned_to !='') && ($modelassets->assigned_to > 0)) { return ''.Lang::get('general.checkin').''; } else { diff --git a/app/controllers/admin/SettingsController.php b/app/controllers/admin/SettingsController.php index eedd7ac493..1af3435958 100755 --- a/app/controllers/admin/SettingsController.php +++ b/app/controllers/admin/SettingsController.php @@ -94,6 +94,7 @@ class SettingsController extends AdminController if (Input::get('clear_logo')=='1') { $setting->logo = NULL; } elseif (Input::file('logo')) { + if (!Config::get('app.lock_passwords')) { $image = Input::file('logo'); $file_name = "logo.".$image->getClientOriginalExtension(); $path = public_path('uploads/'.$file_name); @@ -102,6 +103,7 @@ class SettingsController extends AdminController $constraint->upsize(); })->save($path); $setting->logo = $file_name; + } } diff --git a/app/controllers/admin/UsersController.php b/app/controllers/admin/UsersController.php index bf7a4d5986..8e323ef78a 100755 --- a/app/controllers/admin/UsersController.php +++ b/app/controllers/admin/UsersController.php @@ -246,6 +246,11 @@ class UsersController extends AdminController $this->decodePermissions($permissions); app('request')->request->set('permissions', $permissions); + // Only update the email address if locking is set to false + if (Config::get('app.lock_passwords')) { + return Redirect::route('users')->with('error', 'Denied! You cannot update user information on the demo.'); + } + try { // Get the user information $user = Sentry::getUserProvider()->findById($id); @@ -278,11 +283,6 @@ class UsersController extends AdminController return Redirect::back()->withInput()->withErrors($validator); } - // Only update the email address if locking is set to false - if (!Config::get('app.lock_passwords')) { - $user->email = Input::get('email'); - } - try { // Update the user $user->first_name = Input::get('first_name'); @@ -326,7 +326,6 @@ class UsersController extends AdminController // Assign the user to groups foreach ($groupsToAdd as $groupId) { $group = Sentry::getGroupProvider()->findById($groupId); - $user->addGroup($group); } diff --git a/app/lang/en/general.php b/app/lang/en/general.php index eabdb3e1f8..0816eabfb6 100755 --- a/app/lang/en/general.php +++ b/app/lang/en/general.php @@ -70,6 +70,7 @@ return array( 'licenses' => 'Licenses', 'list_all' => 'List All', 'loading' => 'Loading', + 'lock_passwords' => 'This field cannot be edited in this installation.', 'location' => 'Location', 'locations' => 'Locations', 'logout' => 'Logout', diff --git a/app/models/Model.php b/app/models/Model.php index cd43ee0ef4..802b83acbc 100755 --- a/app/models/Model.php +++ b/app/models/Model.php @@ -40,13 +40,13 @@ class Model extends Elegant { return $this->belongsTo('Manufacturer','manufacturer_id'); } - + /** - ----------------------------------------------- - BEGIN QUERY SCOPES - ----------------------------------------------- + * ----------------------------------------------- + * BEGIN QUERY SCOPES + * ----------------------------------------------- **/ - + /** * Query builder scope for Deleted assets * diff --git a/app/views/backend/models/index.blade.php b/app/views/backend/models/index.blade.php index 749e86ab31..9695b6c0da 100755 --- a/app/views/backend/models/index.blade.php +++ b/app/views/backend/models/index.blade.php @@ -23,12 +23,13 @@