Passed
Push — master ( 018e18...77d661 )
by Morris
14:36 queued 12s
created
apps/twofactor_backupcodes/lib/Db/BackupCode.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@
 block discarded – undo
34 34
  */
35 35
 class BackupCode extends Entity {
36 36
 
37
-	/** @var string */
38
-	protected $userId;
37
+    /** @var string */
38
+    protected $userId;
39 39
 
40
-	/** @var string */
41
-	protected $code;
40
+    /** @var string */
41
+    protected $code;
42 42
 
43
-	/** @var int */
44
-	protected $used;
43
+    /** @var int */
44
+    protected $used;
45 45
 
46 46
 }
Please login to merge, or discard this patch.
apps/comments/lib/Activity/Setting.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,72 +27,72 @@
 block discarded – undo
27 27
 
28 28
 class Setting implements ISetting {
29 29
 
30
-	/** @var IL10N */
31
-	protected $l;
30
+    /** @var IL10N */
31
+    protected $l;
32 32
 
33
-	/**
34
-	 * @param IL10N $l
35
-	 */
36
-	public function __construct(IL10N $l) {
37
-		$this->l = $l;
38
-	}
33
+    /**
34
+     * @param IL10N $l
35
+     */
36
+    public function __construct(IL10N $l) {
37
+        $this->l = $l;
38
+    }
39 39
 
40
-	/**
41
-	 * @return string Lowercase a-z and underscore only identifier
42
-	 * @since 11.0.0
43
-	 */
44
-	public function getIdentifier() {
45
-		return 'comments';
46
-	}
40
+    /**
41
+     * @return string Lowercase a-z and underscore only identifier
42
+     * @since 11.0.0
43
+     */
44
+    public function getIdentifier() {
45
+        return 'comments';
46
+    }
47 47
 
48
-	/**
49
-	 * @return string A translated string
50
-	 * @since 11.0.0
51
-	 */
52
-	public function getName() {
53
-		return $this->l->t('<strong>Comments</strong> for files');
54
-	}
48
+    /**
49
+     * @return string A translated string
50
+     * @since 11.0.0
51
+     */
52
+    public function getName() {
53
+        return $this->l->t('<strong>Comments</strong> for files');
54
+    }
55 55
 
56
-	/**
57
-	 * @return int whether the filter should be rather on the top or bottom of
58
-	 * the admin section. The filters are arranged in ascending order of the
59
-	 * priority values. It is required to return a value between 0 and 100.
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 50;
64
-	}
56
+    /**
57
+     * @return int whether the filter should be rather on the top or bottom of
58
+     * the admin section. The filters are arranged in ascending order of the
59
+     * priority values. It is required to return a value between 0 and 100.
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 50;
64
+    }
65 65
 
66
-	/**
67
-	 * @return bool True when the option can be changed for the stream
68
-	 * @since 11.0.0
69
-	 */
70
-	public function canChangeStream() {
71
-		return true;
72
-	}
66
+    /**
67
+     * @return bool True when the option can be changed for the stream
68
+     * @since 11.0.0
69
+     */
70
+    public function canChangeStream() {
71
+        return true;
72
+    }
73 73
 
74
-	/**
75
-	 * @return bool True when the option can be changed for the stream
76
-	 * @since 11.0.0
77
-	 */
78
-	public function isDefaultEnabledStream() {
79
-		return true;
80
-	}
74
+    /**
75
+     * @return bool True when the option can be changed for the stream
76
+     * @since 11.0.0
77
+     */
78
+    public function isDefaultEnabledStream() {
79
+        return true;
80
+    }
81 81
 
82
-	/**
83
-	 * @return bool True when the option can be changed for the mail
84
-	 * @since 11.0.0
85
-	 */
86
-	public function canChangeMail() {
87
-		return true;
88
-	}
82
+    /**
83
+     * @return bool True when the option can be changed for the mail
84
+     * @since 11.0.0
85
+     */
86
+    public function canChangeMail() {
87
+        return true;
88
+    }
89 89
 
90
-	/**
91
-	 * @return bool True when the option can be changed for the stream
92
-	 * @since 11.0.0
93
-	 */
94
-	public function isDefaultEnabledMail() {
95
-		return false;
96
-	}
90
+    /**
91
+     * @return bool True when the option can be changed for the stream
92
+     * @since 11.0.0
93
+     */
94
+    public function isDefaultEnabledMail() {
95
+        return false;
96
+    }
97 97
 }
98 98
 
Please login to merge, or discard this patch.
apps/comments/lib/Activity/Filter.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -28,63 +28,63 @@
 block discarded – undo
28 28
 
29 29
 class Filter implements IFilter {
30 30
 
31
-	/** @var IL10N */
32
-	protected $l;
31
+    /** @var IL10N */
32
+    protected $l;
33 33
 
34
-	/** @var IURLGenerator */
35
-	protected $url;
34
+    /** @var IURLGenerator */
35
+    protected $url;
36 36
 
37
-	public function __construct(IL10N $l, IURLGenerator $url) {
38
-		$this->l = $l;
39
-		$this->url = $url;
40
-	}
37
+    public function __construct(IL10N $l, IURLGenerator $url) {
38
+        $this->l = $l;
39
+        $this->url = $url;
40
+    }
41 41
 
42
-	/**
43
-	 * @return string Lowercase a-z only identifier
44
-	 * @since 11.0.0
45
-	 */
46
-	public function getIdentifier() {
47
-		return 'comments';
48
-	}
42
+    /**
43
+     * @return string Lowercase a-z only identifier
44
+     * @since 11.0.0
45
+     */
46
+    public function getIdentifier() {
47
+        return 'comments';
48
+    }
49 49
 
50
-	/**
51
-	 * @return string A translated string
52
-	 * @since 11.0.0
53
-	 */
54
-	public function getName() {
55
-		return $this->l->t('Comments');
56
-	}
50
+    /**
51
+     * @return string A translated string
52
+     * @since 11.0.0
53
+     */
54
+    public function getName() {
55
+        return $this->l->t('Comments');
56
+    }
57 57
 
58
-	/**
59
-	 * @return int
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 40;
64
-	}
58
+    /**
59
+     * @return int
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 40;
64
+    }
65 65
 
66
-	/**
67
-	 * @return string Full URL to an icon, empty string when none is given
68
-	 * @since 11.0.0
69
-	 */
70
-	public function getIcon() {
71
-		return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'));
72
-	}
66
+    /**
67
+     * @return string Full URL to an icon, empty string when none is given
68
+     * @since 11.0.0
69
+     */
70
+    public function getIcon() {
71
+        return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'));
72
+    }
73 73
 
74
-	/**
75
-	 * @param string[] $types
76
-	 * @return string[] An array of allowed apps from which activities should be displayed
77
-	 * @since 11.0.0
78
-	 */
79
-	public function filterTypes(array $types) {
80
-		return $types;
81
-	}
74
+    /**
75
+     * @param string[] $types
76
+     * @return string[] An array of allowed apps from which activities should be displayed
77
+     * @since 11.0.0
78
+     */
79
+    public function filterTypes(array $types) {
80
+        return $types;
81
+    }
82 82
 
83
-	/**
84
-	 * @return string[] An array of allowed apps from which activities should be displayed
85
-	 * @since 11.0.0
86
-	 */
87
-	public function allowedApps() {
88
-		return ['comments'];
89
-	}
83
+    /**
84
+     * @return string[] An array of allowed apps from which activities should be displayed
85
+     * @since 11.0.0
86
+     */
87
+    public function allowedApps() {
88
+        return ['comments'];
89
+    }
90 90
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Capabilities.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,17 +33,17 @@
 block discarded – undo
33 33
  */
34 34
 class Capabilities implements ICapability {
35 35
 
36
-	/**
37
-	 * Return this classes capabilities
38
-	 *
39
-	 * @return array
40
-	 */
41
-	public function getCapabilities() {
42
-		return [
43
-			'files' => [
44
-				'undelete' => true
45
-			]
46
-		];
47
-	}
36
+    /**
37
+     * Return this classes capabilities
38
+     *
39
+     * @return array
40
+     */
41
+    public function getCapabilities() {
42
+        return [
43
+            'files' => [
44
+                'undelete' => true
45
+            ]
46
+        ];
47
+    }
48 48
 	
49 49
 }
Please login to merge, or discard this patch.
apps/testing/lib/AlternativeHomeUserBackend.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,23 +34,23 @@
 block discarded – undo
34 34
  *	]
35 35
  */
36 36
 class AlternativeHomeUserBackend extends \OC\User\Database {
37
-	public function __construct() {
38
-		parent::__construct();
39
-	}
40
-	/**
41
-	 * get the user's home directory
42
-	 * @param string $uid the username
43
-	 * @return string|false
44
-	 */
45
-	public function getHome($uid) {
46
-		if ($this->userExists($uid)) {
47
-			// workaround to avoid killing the admin
48
-			if ($uid !== 'admin') {
49
-				$uid = md5($uid);
50
-			}
51
-			return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid;
52
-		}
37
+    public function __construct() {
38
+        parent::__construct();
39
+    }
40
+    /**
41
+     * get the user's home directory
42
+     * @param string $uid the username
43
+     * @return string|false
44
+     */
45
+    public function getHome($uid) {
46
+        if ($this->userExists($uid)) {
47
+            // workaround to avoid killing the admin
48
+            if ($uid !== 'admin') {
49
+                $uid = md5($uid);
50
+            }
51
+            return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid;
52
+        }
53 53
 
54
-		return false;
55
-	}
54
+        return false;
55
+    }
56 56
 }
Please login to merge, or discard this patch.
apps/dav/lib/Migration/FixBirthdayCalendarComponent.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -28,35 +28,35 @@
 block discarded – undo
28 28
 
29 29
 class FixBirthdayCalendarComponent implements IRepairStep {
30 30
 
31
-	/** @var IDBConnection */
32
-	private $connection;
33
-
34
-	/**
35
-	 * FixBirthdayCalendarComponent constructor.
36
-	 *
37
-	 * @param IDBConnection $connection
38
-	 */
39
-	public function __construct(IDBConnection $connection) {
40
-		$this->connection = $connection;
41
-	}
42
-
43
-	/**
44
-	 * @inheritdoc
45
-	 */
46
-	public function getName() {
47
-		return 'Fix component of birthday calendars';
48
-	}
49
-
50
-	/**
51
-	 * @inheritdoc
52
-	 */
53
-	public function run(IOutput $output) {
54
-		$query = $this->connection->getQueryBuilder();
55
-		$updated = $query->update('calendars')
56
-			->set('components', $query->createNamedParameter('VEVENT'))
57
-			->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
58
-			->execute();
59
-
60
-		$output->info("$updated birthday calendars updated.");
61
-	}
31
+    /** @var IDBConnection */
32
+    private $connection;
33
+
34
+    /**
35
+     * FixBirthdayCalendarComponent constructor.
36
+     *
37
+     * @param IDBConnection $connection
38
+     */
39
+    public function __construct(IDBConnection $connection) {
40
+        $this->connection = $connection;
41
+    }
42
+
43
+    /**
44
+     * @inheritdoc
45
+     */
46
+    public function getName() {
47
+        return 'Fix component of birthday calendars';
48
+    }
49
+
50
+    /**
51
+     * @inheritdoc
52
+     */
53
+    public function run(IOutput $output) {
54
+        $query = $this->connection->getQueryBuilder();
55
+        $updated = $query->update('calendars')
56
+            ->set('components', $query->createNamedParameter('VEVENT'))
57
+            ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
58
+            ->execute();
59
+
60
+        $output->info("$updated birthday calendars updated.");
61
+    }
62 62
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Activity/Filter/Todo.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -28,65 +28,65 @@
 block discarded – undo
28 28
 
29 29
 class Todo implements IFilter {
30 30
 
31
-	/** @var IL10N */
32
-	protected $l;
31
+    /** @var IL10N */
32
+    protected $l;
33 33
 
34
-	/** @var IURLGenerator */
35
-	protected $url;
34
+    /** @var IURLGenerator */
35
+    protected $url;
36 36
 
37
-	public function __construct(IL10N $l, IURLGenerator $url) {
38
-		$this->l = $l;
39
-		$this->url = $url;
40
-	}
37
+    public function __construct(IL10N $l, IURLGenerator $url) {
38
+        $this->l = $l;
39
+        $this->url = $url;
40
+    }
41 41
 
42
-	/**
43
-	 * @return string Lowercase a-z and underscore only identifier
44
-	 * @since 11.0.0
45
-	 */
46
-	public function getIdentifier() {
47
-		return 'calendar_todo';
48
-	}
42
+    /**
43
+     * @return string Lowercase a-z and underscore only identifier
44
+     * @since 11.0.0
45
+     */
46
+    public function getIdentifier() {
47
+        return 'calendar_todo';
48
+    }
49 49
 
50
-	/**
51
-	 * @return string A translated string
52
-	 * @since 11.0.0
53
-	 */
54
-	public function getName() {
55
-		return $this->l->t('Todos');
56
-	}
50
+    /**
51
+     * @return string A translated string
52
+     * @since 11.0.0
53
+     */
54
+    public function getName() {
55
+        return $this->l->t('Todos');
56
+    }
57 57
 
58
-	/**
59
-	 * @return int whether the filter should be rather on the top or bottom of
60
-	 * the admin section. The filters are arranged in ascending order of the
61
-	 * priority values. It is required to return a value between 0 and 100.
62
-	 * @since 11.0.0
63
-	 */
64
-	public function getPriority() {
65
-		return 40;
66
-	}
58
+    /**
59
+     * @return int whether the filter should be rather on the top or bottom of
60
+     * the admin section. The filters are arranged in ascending order of the
61
+     * priority values. It is required to return a value between 0 and 100.
62
+     * @since 11.0.0
63
+     */
64
+    public function getPriority() {
65
+        return 40;
66
+    }
67 67
 
68
-	/**
69
-	 * @return string Full URL to an icon, empty string when none is given
70
-	 * @since 11.0.0
71
-	 */
72
-	public function getIcon() {
73
-		return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg'));
74
-	}
68
+    /**
69
+     * @return string Full URL to an icon, empty string when none is given
70
+     * @since 11.0.0
71
+     */
72
+    public function getIcon() {
73
+        return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg'));
74
+    }
75 75
 
76
-	/**
77
-	 * @param string[] $types
78
-	 * @return string[] An array of allowed apps from which activities should be displayed
79
-	 * @since 11.0.0
80
-	 */
81
-	public function filterTypes(array $types) {
82
-		return array_intersect(['calendar_todo'], $types);
83
-	}
76
+    /**
77
+     * @param string[] $types
78
+     * @return string[] An array of allowed apps from which activities should be displayed
79
+     * @since 11.0.0
80
+     */
81
+    public function filterTypes(array $types) {
82
+        return array_intersect(['calendar_todo'], $types);
83
+    }
84 84
 
85
-	/**
86
-	 * @return string[] An array of allowed apps from which activities should be displayed
87
-	 * @since 11.0.0
88
-	 */
89
-	public function allowedApps() {
90
-		return [];
91
-	}
85
+    /**
86
+     * @return string[] An array of allowed apps from which activities should be displayed
87
+     * @since 11.0.0
88
+     */
89
+    public function allowedApps() {
90
+        return [];
91
+    }
92 92
 }
Please login to merge, or discard this patch.
apps/dav/lib/SystemTag/SystemTagNode.php 1 patch
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -39,136 +39,136 @@
 block discarded – undo
39 39
  */
40 40
 class SystemTagNode implements \Sabre\DAV\INode {
41 41
 
42
-	/**
43
-	 * @var ISystemTag
44
-	 */
45
-	protected $tag;
46
-
47
-	/**
48
-	 * @var ISystemTagManager
49
-	 */
50
-	protected $tagManager;
51
-
52
-	/**
53
-	 * User
54
-	 *
55
-	 * @var IUser
56
-	 */
57
-	protected $user;
58
-
59
-	/**
60
-	 * Whether to allow permissions for admins
61
-	 *
62
-	 * @var bool
63
-	 */
64
-	protected $isAdmin;
65
-
66
-	/**
67
-	 * Sets up the node, expects a full path name
68
-	 *
69
-	 * @param ISystemTag $tag system tag
70
-	 * @param IUser $user user
71
-	 * @param bool $isAdmin whether to allow operations for admins
72
-	 * @param ISystemTagManager $tagManager tag manager
73
-	 */
74
-	public function __construct(ISystemTag $tag, IUser $user, $isAdmin, ISystemTagManager $tagManager) {
75
-		$this->tag = $tag;
76
-		$this->user = $user;
77
-		$this->isAdmin = $isAdmin;
78
-		$this->tagManager = $tagManager;
79
-	}
80
-
81
-	/**
82
-	 *  Returns the id of the tag
83
-	 *
84
-	 * @return string
85
-	 */
86
-	public function getName() {
87
-		return $this->tag->getId();
88
-	}
89
-
90
-	/**
91
-	 * Returns the system tag represented by this node
92
-	 *
93
-	 * @return ISystemTag system tag
94
-	 */
95
-	public function getSystemTag() {
96
-		return $this->tag;
97
-	}
98
-
99
-	/**
100
-	 * Renames the node
101
-	 *
102
-	 * @param string $name The new name
103
-	 *
104
-	 * @throws MethodNotAllowed not allowed to rename node
105
-	 */
106
-	public function setName($name) {
107
-		throw new MethodNotAllowed();
108
-	}
109
-
110
-	/**
111
-	 * Update tag
112
-	 *
113
-	 * @param string $name new tag name
114
-	 * @param bool $userVisible user visible
115
-	 * @param bool $userAssignable user assignable
116
-	 * @throws NotFound whenever the given tag id does not exist
117
-	 * @throws Forbidden whenever there is no permission to update said tag
118
-	 * @throws Conflict whenever a tag already exists with the given attributes
119
-	 */
120
-	public function update($name, $userVisible, $userAssignable) {
121
-		try {
122
-			if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) {
123
-				throw new NotFound('Tag with id ' . $this->tag->getId() . ' does not exist');
124
-			}
125
-			if (!$this->tagManager->canUserAssignTag($this->tag, $this->user)) {
126
-				throw new Forbidden('No permission to update tag ' . $this->tag->getId());
127
-			}
128
-
129
-			// only admin is able to change permissions, regular users can only rename
130
-			if (!$this->isAdmin) {
131
-				// only renaming is allowed for regular users
132
-				if ($userVisible !== $this->tag->isUserVisible()
133
-					|| $userAssignable !== $this->tag->isUserAssignable()
134
-				) {
135
-					throw new Forbidden('No permission to update permissions for tag ' . $this->tag->getId());
136
-				}
137
-			}
138
-
139
-			$this->tagManager->updateTag($this->tag->getId(), $name, $userVisible, $userAssignable);
140
-		} catch (TagNotFoundException $e) {
141
-			throw new NotFound('Tag with id ' . $this->tag->getId() . ' does not exist');
142
-		} catch (TagAlreadyExistsException $e) {
143
-			throw new Conflict(
144
-				'Tag with the properties "' . $name . '", ' .
145
-				$userVisible . ', ' . $userAssignable . ' already exists'
146
-			);
147
-		}
148
-	}
149
-
150
-	/**
151
-	 * Returns null, not supported
152
-	 *
153
-	 */
154
-	public function getLastModified() {
155
-		return null;
156
-	}
157
-
158
-	public function delete() {
159
-		try {
160
-			if (!$this->isAdmin) {
161
-				throw new Forbidden('No permission to delete tag ' . $this->tag->getId());
162
-			}
163
-
164
-			if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) {
165
-				throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found');
166
-			}
167
-
168
-			$this->tagManager->deleteTags($this->tag->getId());
169
-		} catch (TagNotFoundException $e) {
170
-			// can happen if concurrent deletion occurred
171
-			throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found', 0, $e);
172
-		}
173
-	}
42
+    /**
43
+     * @var ISystemTag
44
+     */
45
+    protected $tag;
46
+
47
+    /**
48
+     * @var ISystemTagManager
49
+     */
50
+    protected $tagManager;
51
+
52
+    /**
53
+     * User
54
+     *
55
+     * @var IUser
56
+     */
57
+    protected $user;
58
+
59
+    /**
60
+     * Whether to allow permissions for admins
61
+     *
62
+     * @var bool
63
+     */
64
+    protected $isAdmin;
65
+
66
+    /**
67
+     * Sets up the node, expects a full path name
68
+     *
69
+     * @param ISystemTag $tag system tag
70
+     * @param IUser $user user
71
+     * @param bool $isAdmin whether to allow operations for admins
72
+     * @param ISystemTagManager $tagManager tag manager
73
+     */
74
+    public function __construct(ISystemTag $tag, IUser $user, $isAdmin, ISystemTagManager $tagManager) {
75
+        $this->tag = $tag;
76
+        $this->user = $user;
77
+        $this->isAdmin = $isAdmin;
78
+        $this->tagManager = $tagManager;
79
+    }
80
+
81
+    /**
82
+     *  Returns the id of the tag
83
+     *
84
+     * @return string
85
+     */
86
+    public function getName() {
87
+        return $this->tag->getId();
88
+    }
89
+
90
+    /**
91
+     * Returns the system tag represented by this node
92
+     *
93
+     * @return ISystemTag system tag
94
+     */
95
+    public function getSystemTag() {
96
+        return $this->tag;
97
+    }
98
+
99
+    /**
100
+     * Renames the node
101
+     *
102
+     * @param string $name The new name
103
+     *
104
+     * @throws MethodNotAllowed not allowed to rename node
105
+     */
106
+    public function setName($name) {
107
+        throw new MethodNotAllowed();
108
+    }
109
+
110
+    /**
111
+     * Update tag
112
+     *
113
+     * @param string $name new tag name
114
+     * @param bool $userVisible user visible
115
+     * @param bool $userAssignable user assignable
116
+     * @throws NotFound whenever the given tag id does not exist
117
+     * @throws Forbidden whenever there is no permission to update said tag
118
+     * @throws Conflict whenever a tag already exists with the given attributes
119
+     */
120
+    public function update($name, $userVisible, $userAssignable) {
121
+        try {
122
+            if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) {
123
+                throw new NotFound('Tag with id ' . $this->tag->getId() . ' does not exist');
124
+            }
125
+            if (!$this->tagManager->canUserAssignTag($this->tag, $this->user)) {
126
+                throw new Forbidden('No permission to update tag ' . $this->tag->getId());
127
+            }
128
+
129
+            // only admin is able to change permissions, regular users can only rename
130
+            if (!$this->isAdmin) {
131
+                // only renaming is allowed for regular users
132
+                if ($userVisible !== $this->tag->isUserVisible()
133
+                    || $userAssignable !== $this->tag->isUserAssignable()
134
+                ) {
135
+                    throw new Forbidden('No permission to update permissions for tag ' . $this->tag->getId());
136
+                }
137
+            }
138
+
139
+            $this->tagManager->updateTag($this->tag->getId(), $name, $userVisible, $userAssignable);
140
+        } catch (TagNotFoundException $e) {
141
+            throw new NotFound('Tag with id ' . $this->tag->getId() . ' does not exist');
142
+        } catch (TagAlreadyExistsException $e) {
143
+            throw new Conflict(
144
+                'Tag with the properties "' . $name . '", ' .
145
+                $userVisible . ', ' . $userAssignable . ' already exists'
146
+            );
147
+        }
148
+    }
149
+
150
+    /**
151
+     * Returns null, not supported
152
+     *
153
+     */
154
+    public function getLastModified() {
155
+        return null;
156
+    }
157
+
158
+    public function delete() {
159
+        try {
160
+            if (!$this->isAdmin) {
161
+                throw new Forbidden('No permission to delete tag ' . $this->tag->getId());
162
+            }
163
+
164
+            if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) {
165
+                throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found');
166
+            }
167
+
168
+            $this->tagManager->deleteTags($this->tag->getId());
169
+        } catch (TagNotFoundException $e) {
170
+            // can happen if concurrent deletion occurred
171
+            throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found', 0, $e);
172
+        }
173
+    }
174 174
 }
Please login to merge, or discard this patch.
apps/dav/lib/SystemTag/SystemTagMappingNode.php 1 patch
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -37,134 +37,134 @@
 block discarded – undo
37 37
  * Mapping node for system tag to object id
38 38
  */
39 39
 class SystemTagMappingNode implements \Sabre\DAV\INode {
40
-	/**
41
-	 * @var ISystemTag
42
-	 */
43
-	protected $tag;
44
-
45
-	/**
46
-	 * @var string
47
-	 */
48
-	private $objectId;
49
-
50
-	/**
51
-	 * @var string
52
-	 */
53
-	private $objectType;
54
-
55
-	/**
56
-	 * User
57
-	 *
58
-	 * @var IUser
59
-	 */
60
-	protected $user;
61
-
62
-	/**
63
-	 * @var ISystemTagManager
64
-	 */
65
-	protected $tagManager;
66
-
67
-	/**
68
-	 * @var ISystemTagObjectMapper
69
-	 */
70
-	private $tagMapper;
71
-
72
-	/**
73
-	 * Sets up the node, expects a full path name
74
-	 *
75
-	 * @param ISystemTag $tag system tag
76
-	 * @param string $objectId
77
-	 * @param string $objectType
78
-	 * @param IUser $user user
79
-	 * @param ISystemTagManager $tagManager
80
-	 * @param ISystemTagObjectMapper $tagMapper
81
-	 */
82
-	public function __construct(
83
-		ISystemTag $tag,
84
-		$objectId,
85
-		$objectType,
86
-		IUser $user,
87
-		ISystemTagManager $tagManager,
88
-		ISystemTagObjectMapper $tagMapper
89
-	) {
90
-		$this->tag = $tag;
91
-		$this->objectId = $objectId;
92
-		$this->objectType = $objectType;
93
-		$this->user = $user;
94
-		$this->tagManager = $tagManager;
95
-		$this->tagMapper = $tagMapper;
96
-	}
97
-
98
-	/**
99
-	 * Returns the object id of the relationship
100
-	 *
101
-	 * @return string object id
102
-	 */
103
-	public function getObjectId() {
104
-		return $this->objectId;
105
-	}
106
-
107
-	/**
108
-	 * Returns the object type of the relationship
109
-	 *
110
-	 * @return string object type
111
-	 */
112
-	public function getObjectType() {
113
-		return $this->objectType;
114
-	}
115
-
116
-	/**
117
-	 * Returns the system tag represented by this node
118
-	 *
119
-	 * @return ISystemTag system tag
120
-	 */
121
-	public function getSystemTag() {
122
-		return $this->tag;
123
-	}
124
-
125
-	/**
126
-	 *  Returns the id of the tag
127
-	 *
128
-	 * @return string
129
-	 */
130
-	public function getName() {
131
-		return $this->tag->getId();
132
-	}
133
-
134
-	/**
135
-	 * Renames the node
136
-	 *
137
-	 * @param string $name The new name
138
-	 *
139
-	 * @throws MethodNotAllowed not allowed to rename node
140
-	 */
141
-	public function setName($name) {
142
-		throw new MethodNotAllowed();
143
-	}
144
-
145
-	/**
146
-	 * Returns null, not supported
147
-	 *
148
-	 */
149
-	public function getLastModified() {
150
-		return null;
151
-	}
152
-
153
-	/**
154
-	 * Delete tag to object association
155
-	 */
156
-	public function delete() {
157
-		try {
158
-			if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) {
159
-				throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found');
160
-			}
161
-			if (!$this->tagManager->canUserAssignTag($this->tag, $this->user)) {
162
-				throw new Forbidden('No permission to unassign tag ' . $this->tag->getId());
163
-			}
164
-			$this->tagMapper->unassignTags($this->objectId, $this->objectType, $this->tag->getId());
165
-		} catch (TagNotFoundException $e) {
166
-			// can happen if concurrent deletion occurred
167
-			throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found', 0, $e);
168
-		}
169
-	}
40
+    /**
41
+     * @var ISystemTag
42
+     */
43
+    protected $tag;
44
+
45
+    /**
46
+     * @var string
47
+     */
48
+    private $objectId;
49
+
50
+    /**
51
+     * @var string
52
+     */
53
+    private $objectType;
54
+
55
+    /**
56
+     * User
57
+     *
58
+     * @var IUser
59
+     */
60
+    protected $user;
61
+
62
+    /**
63
+     * @var ISystemTagManager
64
+     */
65
+    protected $tagManager;
66
+
67
+    /**
68
+     * @var ISystemTagObjectMapper
69
+     */
70
+    private $tagMapper;
71
+
72
+    /**
73
+     * Sets up the node, expects a full path name
74
+     *
75
+     * @param ISystemTag $tag system tag
76
+     * @param string $objectId
77
+     * @param string $objectType
78
+     * @param IUser $user user
79
+     * @param ISystemTagManager $tagManager
80
+     * @param ISystemTagObjectMapper $tagMapper
81
+     */
82
+    public function __construct(
83
+        ISystemTag $tag,
84
+        $objectId,
85
+        $objectType,
86
+        IUser $user,
87
+        ISystemTagManager $tagManager,
88
+        ISystemTagObjectMapper $tagMapper
89
+    ) {
90
+        $this->tag = $tag;
91
+        $this->objectId = $objectId;
92
+        $this->objectType = $objectType;
93
+        $this->user = $user;
94
+        $this->tagManager = $tagManager;
95
+        $this->tagMapper = $tagMapper;
96
+    }
97
+
98
+    /**
99
+     * Returns the object id of the relationship
100
+     *
101
+     * @return string object id
102
+     */
103
+    public function getObjectId() {
104
+        return $this->objectId;
105
+    }
106
+
107
+    /**
108
+     * Returns the object type of the relationship
109
+     *
110
+     * @return string object type
111
+     */
112
+    public function getObjectType() {
113
+        return $this->objectType;
114
+    }
115
+
116
+    /**
117
+     * Returns the system tag represented by this node
118
+     *
119
+     * @return ISystemTag system tag
120
+     */
121
+    public function getSystemTag() {
122
+        return $this->tag;
123
+    }
124
+
125
+    /**
126
+     *  Returns the id of the tag
127
+     *
128
+     * @return string
129
+     */
130
+    public function getName() {
131
+        return $this->tag->getId();
132
+    }
133
+
134
+    /**
135
+     * Renames the node
136
+     *
137
+     * @param string $name The new name
138
+     *
139
+     * @throws MethodNotAllowed not allowed to rename node
140
+     */
141
+    public function setName($name) {
142
+        throw new MethodNotAllowed();
143
+    }
144
+
145
+    /**
146
+     * Returns null, not supported
147
+     *
148
+     */
149
+    public function getLastModified() {
150
+        return null;
151
+    }
152
+
153
+    /**
154
+     * Delete tag to object association
155
+     */
156
+    public function delete() {
157
+        try {
158
+            if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) {
159
+                throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found');
160
+            }
161
+            if (!$this->tagManager->canUserAssignTag($this->tag, $this->user)) {
162
+                throw new Forbidden('No permission to unassign tag ' . $this->tag->getId());
163
+            }
164
+            $this->tagMapper->unassignTags($this->objectId, $this->objectType, $this->tag->getId());
165
+        } catch (TagNotFoundException $e) {
166
+            // can happen if concurrent deletion occurred
167
+            throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found', 0, $e);
168
+        }
169
+    }
170 170
 }
Please login to merge, or discard this patch.