File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323namespace OCA \Deck \Reference ;
2424
2525use OCA \Deck \AppInfo \Application ;
26+ use OCA \Deck \NoPermissionException ;
2627use OCA \Deck \Service \BoardService ;
2728use OCP \Collaboration \Reference \IReference ;
2829use OCP \Collaboration \Reference \IReferenceProvider ;
@@ -67,7 +68,12 @@ public function resolveReference(string $referenceText): ?IReference {
6768 if ($ this ->matchReference ($ referenceText )) {
6869 $ boardId = $ this ->getBoardId ($ referenceText );
6970 if ($ boardId !== null ) {
70- $ board = $ this ->boardService ->find ($ boardId )->jsonSerialize ();
71+ try {
72+ $ board = $ this ->boardService ->find ($ boardId )->jsonSerialize ();
73+ } catch (NoPermissionException $ e ) {
74+ // Skip throwing if user has no permissions
75+ return null ;
76+ }
7177 $ board = $ this ->sanitizeSerializedBoard ($ board );
7278 /** @var IReference $reference */
7379 $ reference = new Reference ($ referenceText );
Original file line number Diff line number Diff line change 2727use OCA \Deck \Db \Attachment ;
2828use OCA \Deck \Db \Label ;
2929use OCA \Deck \Model \CardDetails ;
30+ use OCA \Deck \NoPermissionException ;
3031use OCA \Deck \Service \BoardService ;
3132use OCA \Deck \Service \CardService ;
3233use OCA \Deck \Service \StackService ;
@@ -121,9 +122,15 @@ public function resolveReference(string $referenceText): ?IReference {
121122 $ ids = $ this ->getBoardCardId ($ referenceText );
122123 if ($ ids !== null ) {
123124 [$ boardId , $ cardId ] = $ ids ;
124- $ card = $ this ->cardService ->find ((int ) $ cardId )->jsonSerialize ();
125- $ board = $ this ->boardService ->find ((int ) $ boardId )->jsonSerialize ();
126- $ stack = $ this ->stackService ->find ((int ) $ card ['stackId ' ])->jsonSerialize ();
125+ try {
126+ $ card = $ this ->cardService ->find ((int ) $ cardId )->jsonSerialize ();
127+ $ board = $ this ->boardService ->find ((int ) $ boardId )->jsonSerialize ();
128+ $ stack = $ this ->stackService ->find ((int ) $ card ['stackId ' ])->jsonSerialize ();
129+ } catch (NoPermissionException $ e ) {
130+ // Skip throwing if user has no permissions
131+ return null ;
132+ }
133+
127134
128135 $ card = $ this ->sanitizeSerializedCard ($ card );
129136 $ board = $ this ->sanitizeSerializedBoard ($ board );
Original file line number Diff line number Diff line change 2727use OCA \Deck \Db \Attachment ;
2828use OCA \Deck \Db \Label ;
2929use OCA \Deck \Model \CardDetails ;
30+ use OCA \Deck \NoPermissionException ;
3031use OCA \Deck \Service \BoardService ;
3132use OCA \Deck \Service \CardService ;
3233use OCA \Deck \Service \CommentService ;
@@ -85,9 +86,14 @@ public function resolveReference(string $referenceText): ?IReference {
8586 if ($ ids !== null ) {
8687 [$ boardId , $ cardId , $ commentId ] = $ ids ;
8788
88- $ card = $ this ->cardService ->find ($ cardId )->jsonSerialize ();
89- $ board = $ this ->boardService ->find ($ boardId )->jsonSerialize ();
90- $ stack = $ this ->stackService ->find ((int ) $ card ['stackId ' ])->jsonSerialize ();
89+ try {
90+ $ card = $ this ->cardService ->find ($ cardId )->jsonSerialize ();
91+ $ board = $ this ->boardService ->find ($ boardId )->jsonSerialize ();
92+ $ stack = $ this ->stackService ->find ((int ) $ card ['stackId ' ])->jsonSerialize ();
93+ } catch (NoPermissionException $ e ) {
94+ // Skip throwing if user has no permissions
95+ return null ;
96+ }
9197 $ card = $ this ->sanitizeSerializedCard ($ card );
9298 $ board = $ this ->sanitizeSerializedBoard ($ board );
9399 $ stack = $ this ->sanitizeSerializedStack ($ stack );
You can’t perform that action at this time.
0 commit comments