Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
PrasadChinwal committed Nov 8, 2023
1 parent c809a07 commit d776e59
Show file tree
Hide file tree
Showing 24 changed files with 399 additions and 328 deletions.
Binary file added .DS_Store
Binary file not shown.
75 changes: 12 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,15 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
# UIS ITS Laravel Template

<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
This is a template application for UIS ITS applications built using laravel framework.

## About Laravel
## Features
- User Authentication using [UIS ITS Laravel oidc](https://github.com/uisits/laravel-oidc) package.
- Migrations
- Databases: MySQL, Oracle
- AD-LDAP
- User Management
- User Role Management using [Spatie Permissions](https://spatie.be/docs/laravel-permission/v6/introduction)
- User Feedbacks
- Laravel Telescope for development

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).

Laravel is accessible, powerful, and provides tools required for large, robust applications.

## Learning Laravel

Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.

If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

## Laravel Sponsors

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).

### Premium Partners

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**

## Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

## Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).

## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
## Usage
Binary file added app/.DS_Store
Binary file not shown.
Binary file added app/Console/.DS_Store
Binary file not shown.
127 changes: 4 additions & 123 deletions app/Helpers/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,10 @@
namespace App\Helpers;

use Adldap\Laravel\Facades\Adldap;
use App\Person;
use DateTime;
use Exception;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use jamesiarmes\PhpEws\ArrayType\NonEmptyArrayOfAllItemsType;
use jamesiarmes\PhpEws\Client;
use jamesiarmes\PhpEws\Enumeration\BodyTypeType;
use jamesiarmes\PhpEws\Enumeration\CalendarItemCreateOrDeleteOperationType;
use jamesiarmes\PhpEws\Enumeration\ResponseClassType;
use jamesiarmes\PhpEws\Request\CreateItemType;
use jamesiarmes\PhpEws\Type\BodyType;
use jamesiarmes\PhpEws\Type\CalendarItemType;
use jamesiarmes\PhpEws\Type\ConnectingSIDType;
use jamesiarmes\PhpEws\Type\ExchangeImpersonationType;
use PDO;

class Helper
Expand Down Expand Up @@ -104,80 +93,6 @@ public static function getBannerNetidByUIN($uin)

}

/**
* @return void
*/
public static function addToExchangeCalendar(
$start_string,
$end_string,
$subject,
$body,
$cal_username,
$server,
$username,
$password,
$tz
) {
$version = Client::VERSION_2013;
$start = DateTime::createFromFormat('Y-m-d H:i:s', $start_string);
$end_day_before = DateTime::createFromFormat('Y-m-d H:i:s', $end_string);
$end = $end_day_before->modify('+1 day');

$ews = new Client($server, $username, $password, $version);
$ews->setTimezone($tz);

//Impersonate
$ei = new ExchangeImpersonationType();
$sid = new ConnectingSIDType();
$sid->PrimarySmtpAddress = $cal_username;
$ei->ConnectingSID = $sid;
$ews->setImpersonation($ei);

$request = new CreateItemType();
$request->SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType::SEND_ONLY_TO_ALL;
$request->Items = new NonEmptyArrayOfAllItemsType();

// Build the event to be added.
$event = new CalendarItemType();
$event->Start = $start->format('c');
$event->End = $end->format('c');
$event->Subject = $subject;

$event->LegacyFreeBusyStatus = 'Free';
$event->ReminderIsSet = false;

// Set the event body.
$event->Body = new BodyType();
$event->Body->_ = $body;
$event->Body->BodyType = BodyTypeType::TEXT;

// Add the event to the request. You could add multiple events to create more
// than one in a single request.
$request->Items->CalendarItem[] = $event;

$response = $ews->CreateItem($request);

// Iterate over the results, printing any error messages or event ids.
$response_messages = $response->ResponseMessages->CreateItemResponseMessage;

foreach ($response_messages as $response_message) {
// Make sure the request succeeded.
if ($response_message->ResponseClass != ResponseClassType::SUCCESS) {
$code = $response_message->ResponseCode;
$message = $response_message->MessageText;
Session::flash('success', "Event failed to create with \"$code: $message\"\n");

continue;
}

// Iterate over the created events, printing the id for each.
foreach ($response_message->Items->CalendarItem as $item) {
$id = $item->ItemId->Id;
Session::flash('success', 'The event was successfully added to the calendar.');
}
}
}

/**
* @return mixed|null
*/
Expand Down Expand Up @@ -259,7 +174,10 @@ public static function isDeanDirectorAVC($uin)
public static function getTitleFromUin($uin)
{
$result = '';
$supervisor_info = DB::connection('oraclecdmpvt')->table('EMP_SUPV_DEPT_UIS')->where('uin', $uin)->first();
$supervisor_info = DB::connection('oraclecdmpvt')
->table('EMP_SUPV_DEPT_UIS')
->where('uin', $uin)
->first();

if ($supervisor_info) {
$result = $supervisor_info->posn_title;
Expand All @@ -268,43 +186,6 @@ public static function getTitleFromUin($uin)
return $result;
}

/**
* @return false|string|null
*/
public static function getUinFromBarcode($barcode)
{
$uin = '';
$uin = substr($barcode, 4, 9);

return $uin;
}

/**
* @return mixed|string
*/
public static function getLoggedUserNetid()
{
$result = '';
if (isset($_SERVER['cn'])) {
$result = $_SERVER['cn'];
}

return $result;
}

/**
* @return mixed|string
*/
public static function getLoggedUserUIN()
{
$result = '';
if (isset($_SERVER['iTrustUIN'])) {
$result = $_SERVER['iTrustUIN'];
}

return $result;
}

/**
* @return string
*/
Expand Down
74 changes: 74 additions & 0 deletions app/Http/Controllers/Api/RoleApiController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\RoleRequest;
use App\Http\Resources\RoleResource;
use App\Models\Role;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Validation\ValidationException;

class RoleApiController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}

/**
* Store a newly created resource in storage.
*
* @param RoleRequest $request
* @return RoleResource
* @throws ValidationException
*/
public function store(RoleRequest $request)
{
$role = Role::create([
'name' => $request->validated('name')
]);
return new RoleResource($role);
}

/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\JsonResponse
*/
public function destroy($id)
{
Role::where('id', $id)->delete();
return response()->json(null);
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/UserApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class UserApiController extends Controller
*/
public function index()
{
$users = User::with(['roles'])->orderBy('last_name', 'asc')->get();
$users = User::with(['role'])->orderBy('last_name', 'asc')->get();

return UserResource::collection($users);
}
Expand Down
21 changes: 21 additions & 0 deletions app/Http/Controllers/RoleController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Http\Controllers;

use App\Models\Role;
use App\Models\User;
use Illuminate\Http\Request;

class RoleController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
*/
public function __invoke()
{
$roles = Role::get();
return view('role.index', compact('roles'));
}
}
Loading

0 comments on commit d776e59

Please sign in to comment.