mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-04 15:26:43 +02:00
refactor(auth): change contributor's role logic to have it included in the users_podcasts table
- update myth-auth and codeigniter to latest develop changes - improve permission check: remove all dynamic permissions per podcast and overwrite myth-auth services and permission filter - remove unnecessary code because of myth-auth upgrade - refactor some controller code for better clarity - add remaining seeders in docs closes #19, #20
This commit is contained in:
parent
e0da11517d
commit
58364bfed1
39 changed files with 1197 additions and 685 deletions
28
app/Models/UserModel.php
Normal file
28
app/Models/UserModel.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php namespace App\Models;
|
||||
|
||||
use App\Entities\User;
|
||||
|
||||
class UserModel extends \Myth\Auth\Models\UserModel
|
||||
{
|
||||
protected $returnType = User::class;
|
||||
|
||||
public function getPodcastContributors($podcast_id)
|
||||
{
|
||||
return $this->select('users.*, auth_groups.name as podcast_role')
|
||||
->join('users_podcasts', 'users_podcasts.user_id = users.id')
|
||||
->join('auth_groups', 'auth_groups.id = users_podcasts.group_id')
|
||||
->where('users_podcasts.podcast_id', $podcast_id)
|
||||
->findAll();
|
||||
}
|
||||
|
||||
public function getPodcastContributor($user_id, $podcast_id)
|
||||
{
|
||||
return $this->select('users.*')
|
||||
->join('users_podcasts', 'users_podcasts.user_id = users.id')
|
||||
->where([
|
||||
'users.id' => $user_id,
|
||||
'podcast_id' => $podcast_id,
|
||||
])
|
||||
->first();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue