Completed
Push — master ( 5a9224...8ef25a )
by Joas
44:08 queued 18:07
created

GroupManagement::deleteGroup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2016 Bjoern Schiessle <[email protected]>
4
 *
5
 * @author Bjoern Schiessle <[email protected]>
6
 * @author Lukas Reschke <[email protected]>
7
 * @author Roger Szabo <[email protected]>
8
 *
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
27
namespace OCA\Admin_Audit\Actions;
28
29
30
use OCA\Admin_Audit\Actions\Action;
31
use OCP\IGroup;
32
use OCP\IUser;
33
34
/**
35
 * Class GroupManagement logs all group manager related events
36
 *
37
 * @package OCA\Admin_Audit
38
 */
39
class GroupManagement extends Action {
40
41
	/**
42
	 * log add user to group event
43
	 *
44
	 * @param IGroup $group
45
	 * @param IUser $user
46
	 */
47 View Code Duplication
	public function addUser(IGroup $group, IUser $user) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
		$this->log('User "%s" added to group "%s"',
49
			[
50
				'group' => $group->getGID(),
51
				'user' => $user->getUID()
52
			],
53
			[
54
				'user', 'group'
55
			]
56
		);
57
	}
58
59
	/**
60
	 * log remove user from group event
61
	 *
62
	 * @param IGroup $group
63
	 * @param IUser $user
64
	 */
65 View Code Duplication
	public function removeUser(IGroup $group, IUser $user) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
		$this->log('User "%s" removed from group "%s"',
67
			[
68
				'group' => $group->getGID(),
69
				'user' => $user->getUID()
70
			],
71
			[
72
				'user', 'group'
73
			]
74
		);
75
	}
76
	
77
	/**
78
	 * log create group to group event
79
	 *
80
	 * @param IGroup $group
81
	 */
82
	public function createGroup(IGroup $group) {
83
		$this->log('Group created: "%s"',
84
			[
85
				'group' => $group->getGID()
86
			],
87
			[
88
				'group'
89
			]
90
		);
91
	}
92
93
	/**
94
	 * log delete group to group event
95
	 *
96
	 * @param IGroup $group
97
	 */
98
	public function deleteGroup(IGroup $group) {
99
		$this->log('Group deleted: "%s"',
100
			[
101
				'group' => $group->getGID()
102
			],
103
			[
104
				'group'
105
			]
106
		);
107
	}
108
}
109