Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebUnits repository model is proteced #35

Closed
Mastermori opened this issue Aug 29, 2018 · 9 comments
Closed

WebUnits repository model is proteced #35

Mastermori opened this issue Aug 29, 2018 · 9 comments
Labels
willbesolved will be solved in future release
Milestone

Comments

@Mastermori
Copy link

When I try to log into my school with the admin and default user set to the same user (although it's not an admin, just setting the default doesn't work but thats an issue for another day) and then query the Period repository it gives me this:
Webuntis\Repositories\Repository Object ( [model:protected] => Webuntis\Models\Students [instance:protected] => Webuntis\Webuntis Object ( [path:Webuntis\Webuntis:private] => https://stundenplan.hamburg.de/WebUntis/jsonrpc.do?school=Hh5868 [client:Webuntis\Webuntis:private] => Webuntis\Client\Client Object ( [requiredHttpHeaders:Datto\JsonRpc\Http\Client:private] => Array ( [Accept] => application/json [Content-Type] => application/json [Connection] => close ) [uri:Datto\JsonRpc\Http\Client:private] => https://stundenplan.hamburg.de/WebUntis/jsonrpc.do?school=Hh5868 [headers:Datto\JsonRpc\Http\Client:private] => Array ( [Accept] => application/json [Content-Type] => application/json [Connection] => close [Cookie] => JSESSIONID=39E33EE814222D158102EB94FF825492.nodeTC01; Path=/WebUntis; Version=1; Max-Age=1209600; Expires=Wed, 12-Sep-2018 08:37:05 GMT; ) [context:Datto\JsonRpc\Http\Client:private] => Resource id #20 [client:Datto\JsonRpc\Http\Client:private] => Datto\JsonRpc\Client Object ( [messages:Datto\JsonRpc\Client:private] => Array ( ) ) ) [currentUserId:Webuntis\Webuntis:private] => 224 [currentUserType:Webuntis\Webuntis:private] => 1 [context:Webuntis\Webuntis:private] => admin ) [cache:protected] => [executionHandler:protected] => Webuntis\Handler\ExecutionHandler Object ( [cache:Webuntis\Handler\ExecutionHandler:private] => ) )
So this suggest that I don't have access to the Periods which I know to be false because I can log in to the Web Untis mobile app with that exact data.
Do I need to get an admin-read-only account from my school to get access to the Periods?

@TobiasFranek
Copy link
Owner

if you want the data from the request execute ->findAll() or other method. Please read the docs under Querys and then how to handle Repositories.

@Mastermori
Copy link
Author

Thank you for the quick response but
Uncaught Webuntis\Exceptions\ModelException: There is no Model available for the user type: "1"
is what I get when I try to run the ->findAll() on the $query->get('Period') like this:
print_r($query->get('Period')->findAll());

@Mastermori
Copy link
Author

Mastermori commented Aug 29, 2018

My config looks like this:
$config = new WebuntisConfiguration([\n 'admin' => [\n 'server' => 'stundenplan.hamburg.de',\n 'school' => 'hh5868',\n 'username' => '???',\n 'password' => '???',\n 'path_scheme' => 'https://{server}/WebUntis/jsonrpc.do?school={school}'\n ],\n 'default' => [\n 'server' => 'stundenplan.hamburg.de',\n 'school' => 'hh5868',\n 'username' => '???',\n 'password' => '???',\n 'path_scheme' => 'https://{server}/WebUntis/jsonrpc.do?school={school}'\n ]\n ]);
what might or might not be of interest is that the username starts with the number 1.

@TobiasFranek
Copy link
Owner

This is really strange, because the default UserTypes of the Webuntis Accounts are either 5 for teachers and 2 for students, do you log in with an different account?

@TobiasFranek
Copy link
Owner

and these types will be used to map the right model (Teacher Model, Student Model) to the User, because teachers and students have different endpoints

@TobiasFranek
Copy link
Owner

are your logged in with an klasse object?

@Mastermori
Copy link
Author

No, I'm not, just the default config, I found another libary that works easier now, sorry for bothering you but keep up the good work ^^

@TobiasFranek
Copy link
Owner

yea this library is more for advanced usage, but I'm glad you found your fit.

@TobiasFranek
Copy link
Owner

will be solved in #37 #38 #39

@TobiasFranek TobiasFranek added the willbesolved will be solved in future release label Aug 31, 2018
@TobiasFranek TobiasFranek added this to the 3.1.0 milestone Aug 31, 2018
TobiasFranek pushed a commit that referenced this issue Aug 31, 2018
… this will be used if the type is not know
TobiasFranek pushed a commit that referenced this issue Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
willbesolved will be solved in future release
Projects
None yet
Development

No branches or pull requests

2 participants