@@ -21,7 +21,6 @@ class TagsController extends ApiController {
2121 public function __construct (
2222 string $ appName ,
2323 IRequest $ request ,
24- private string $ userId ,
2524 private DB \TagMapper $ tagMapper ,
2625 private Authorizer $ authorizer ,
2726 ) {
@@ -46,7 +45,7 @@ public function deleteTag(string $old_name = ''): JSONResponse {
4645 }
4746
4847 try {
49- $ this ->tagMapper ->deleteTag ($ this ->userId , $ old_name );
48+ $ this ->tagMapper ->deleteTag ($ this ->authorizer -> getUserId () , $ old_name );
5049 } catch (Exception ) {
5150 return new JSONResponse (['status ' => 'error ' , 'data ' => ['Internal error ' ]], Http::STATUS_INTERNAL_SERVER_ERROR );
5251 }
@@ -74,7 +73,7 @@ public function renameTag(string $old_name = '', string $new_name = '', string $
7473 return new JSONResponse (['status ' => 'error ' , 'data ' => ['Must provide old_name and a new name ' ]], Http::STATUS_BAD_REQUEST );
7574 }
7675
77- $ this ->tagMapper ->renameTag ($ this ->userId , $ old_name , $ new_name );
76+ $ this ->tagMapper ->renameTag ($ this ->authorizer -> getUserId () , $ old_name , $ new_name );
7877 return new JSONResponse (['status ' => 'success ' ]);
7978 }
8079
@@ -92,9 +91,9 @@ public function fullTags(bool $count = false): JSONResponse {
9291
9392 try {
9493 if ($ count === true ) {
95- $ tags = $ this ->tagMapper ->findAllWithCount ($ this ->userId );
94+ $ tags = $ this ->tagMapper ->findAllWithCount ($ this ->authorizer -> getUserId () );
9695 } else {
97- $ tags = $ this ->tagMapper ->findAll ($ this ->userId );
96+ $ tags = $ this ->tagMapper ->findAll ($ this ->authorizer -> getUserId () );
9897 }
9998 } catch (Exception $ e ) {
10099 return new JSONResponse (['status ' => 'error ' , 'data ' => ['Internal error ' ]], Http::STATUS_INTERNAL_SERVER_ERROR );
0 commit comments