Skip to content

Commit

Permalink
add option to accept users after they've been refused
Browse files Browse the repository at this point in the history
  • Loading branch information
kulisse committed Sep 7, 2021
1 parent 4767f76 commit 18b1257
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": true
}
4 changes: 2 additions & 2 deletions backend/config/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
'providers' => [
'users' => [
'driver' => 'ldap',
'model' => LdapRecord\Models\OpenLDAP\User::class,
'model' => LdapRecord\Models\ActiveDirectory\User::class,
'rules' => [],
'database' => [
'model' => App\Models\User::class,
Expand Down Expand Up @@ -125,4 +125,4 @@

'password_timeout' => 10800,

];
];
104 changes: 92 additions & 12 deletions backend/database/seeders/TestUserSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,102 @@ class TestUserSeeder extends Seeder
public function run()
{
DB::table('users')->insert([
'id' => 1,
'name' => 'admin',
'firstname' => 'admin',
'lastname' => 'admin',
'email' => 'steve.mendesreis@he-arc.ch',
'password' => Hash::make('test'),
'id' => 11,
'name' => 'awo-etu',
'firstname' => 'awo-etu',
'lastname' => 'awo-etu',
'email' => 'awo-etu@test.ch',
'password' => Hash::make('password'),
'created_at' => now(),
'updated_at' => now()
]);
DB::table('users')->insert([
'id' => 2,
'name' => 'test',
'firstname' => 'test',
'lastname' => 'test',
'email' => '[email protected]',
'password' => Hash::make('test'),
'id' => 12,
'name' => 'awo-prof',
'firstname' => 'awo-prof',
'lastname' => 'awo-prof',
'email' => '[email protected]',
'password' => Hash::make('password'),
'created_at' => now(),
'updated_at' => now()
]);
DB::table('users')->insert([
'id' => 13,
'name' => 'dgr-etu',
'firstname' => 'dgr-etu',
'lastname' => 'dgr-etu',
'email' => '[email protected]',
'password' => Hash::make('password'),
'created_at' => now(),
'updated_at' => now()
]);
DB::table('users')->insert([
'id' => 14,
'name' => 'dgr-prof',
'firstname' => 'dgr-prof',
'lastname' => 'dgr-prof',
'email' => '[email protected]',
'password' => Hash::make('password'),
'created_at' => now(),
'updated_at' => now()
]);
DB::table('users')->insert([
'id' => 15,
'name' => 'jpe-etu',
'firstname' => 'jpe-etu',
'lastname' => 'jpe-etu',
'email' => '[email protected]',
'password' => Hash::make('password'),
'created_at' => now(),
'updated_at' => now()
]);
DB::table('users')->insert([
'id' => 16,
'name' => 'jpe-prof',
'firstname' => 'jpe-prof',
'lastname' => 'jpe-prof',
'email' => '[email protected]',
'password' => Hash::make('password'),
'created_at' => now(),
'updated_at' => now()
]);
DB::table('users')->insert([
'id' => 17,
'name' => 'jne-etu',
'firstname' => 'jne-etu',
'lastname' => 'jne-etu',
'email' => '[email protected]',
'password' => Hash::make('password'),
'created_at' => now(),
'updated_at' => now()
]);
DB::table('users')->insert([
'id' => 18,
'name' => 'jne-prof',
'firstname' => 'jne-prof',
'lastname' => 'jne-prof',
'email' => '[email protected]',
'password' => Hash::make('password'),
'created_at' => now(),
'updated_at' => now()
]);
DB::table('users')->insert([
'id' => 19,
'name' => 'sbe-etu',
'firstname' => 'sbe-etu',
'lastname' => 'sbe-etu',
'email' => '[email protected]',
'password' => Hash::make('password'),
'created_at' => now(),
'updated_at' => now()
]);
DB::table('users')->insert([
'id' => 20,
'name' => 'sbe-prof',
'firstname' => 'sbe-prof',
'lastname' => 'sbe-prof',
'email' => '[email protected]',
'password' => Hash::make('password'),
'created_at' => now(),
'updated_at' => now()
]);
Expand Down
24 changes: 23 additions & 1 deletion frontend/src/views/Group/Settings/Members.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@
:key="member.id"
:member="member"
:isGroupAdmin="group.user_id == member.id"
/>
>
<v-btn
color="success"
small
class="mx-2"
@click="changeStatus(member, status.ACCEPTED)"
>{{ $t("global.accept") }}</v-btn
>
</member-item>
</template>
</paginate>
</div>
Expand All @@ -79,6 +87,7 @@ import MemberItem from "@/components/MemberItem.vue";
import { User } from "@/types/user";
import ConfirmModal from "@/components/utility/ConfirmModal.vue";
import Paginate from "@/components/utility/Paginate.vue";
import { GroupStatus } from "@/types/helpers";
@Component({
components: {
Expand All @@ -90,6 +99,8 @@ import Paginate from "@/components/utility/Paginate.vue";
export default class GroupMembers extends Vue {
@Ref() readonly confirm!: ConfirmModal;
status = GroupStatus;
get user(): User | undefined {
return authModule.user;
}
Expand Down Expand Up @@ -128,5 +139,16 @@ export default class GroupMembers extends Vue {
this.$toast.error(err.response.data.message);
}
}
async changeStatus(member: Member, status: number): Promise<void> {
if (!this.group) return;
const groupId = this.group.id;
try {
await memberModule.changeStatus({ groupId, member, status });
this.$toast.success(this.$t("global.success").toString());
} catch (err) {
this.$toast.error(err.response.data.message);
}
}
}
</script>

0 comments on commit 18b1257

Please sign in to comment.