Commit 8db237cd authored by Kevin Whitaker's avatar Kevin Whitaker

Have users have upload permissions. Make sure upload tab only shows up then.

parent e1dbdf99
......@@ -46,7 +46,6 @@ WebInterface::WebInterface(const Wt::WEnvironment& env) : Wt::WApplication(env)
root()->addWidget(priv_int->loginUI);
priv_int->loginUI->animateShow(Wt::WAnimation(Wt::WAnimation::AnimationEffect::SlideInFromTop));
priv_int->loginUI->checkSessionValidity();
if(currentUser.isAdmin) priv_int->playerUI->mainDisplay->addTab(priv_int->playerUI->adminPane, "Admin", Wt::WTabWidget::LazyLoading);
notificationSlot.setJavaScript(getNotificationJs(""));
}
......@@ -70,6 +69,8 @@ void WebInterface::loginCompleted()
priv_int->playerUI->updateDetailsFromServer(GroovePlayerMgr::getInstance()->currentTrack);
priv_int->playerUI->updateVoteableTracksFromServer(GroovePlayerMgr::getInstance()->currentVoteBatch);
priv_int->playerUI->updateVoteTrackState();
if(currentUser.canUpload) priv_int->playerUI->mainDisplay->addTab(priv_int->playerUI->uploadPane, "Upload Track", Wt::WTabWidget::LazyLoading);
if(currentUser.isAdmin) priv_int->playerUI->mainDisplay->addTab(priv_int->playerUI->adminPane, "Admin", Wt::WTabWidget::LazyLoading);
}
void WebInterface::playPauseActionFromServer(User userPausing, bool pause)
......
......@@ -31,6 +31,7 @@ public:
std::string passwordSalt;
bool isDisabled;
bool isAdmin;
bool canUpload;
std::string loginCookieToken;
template<class Action>
......@@ -41,6 +42,7 @@ public:
Wt::Dbo::field(a, passwordSalt, "salt");
Wt::Dbo::field(a, isDisabled, "disabled");
Wt::Dbo::field(a, isAdmin, "admin");
Wt::Dbo::field(a, canUpload, "canupload");
Wt::Dbo::field(a, loginCookieToken, "cookie");
}
};
......
......@@ -131,6 +131,7 @@ void LoginInterface::createUser(Wt::Dbo::Session* session, std::string username,
user->isAdmin = isAdmin;
user->username = username;
user->isDisabled = false;
user->canUpload = true;
user->passwordSalt = Wt::WRandom::generateId();
user->passwordHash = hasher.compute(rawPassword, user->passwordSalt);
user->loginCookieToken = Wt::WRandom::generateId();
......
......@@ -125,7 +125,6 @@ PlayerInterface::PlayerInterface(WebInterface* app)
interfaceLayout->addWidget(mainDisplay);
mainDisplay->addTab(voteMetaContainer,"Up Next",Wt::WTabWidget::PreLoading);
mainDisplay->addTab(requestPane, "Make Request", Wt::WTabWidget::LazyLoading);
mainDisplay->addTab(uploadPane, "Upload Track", Wt::WTabWidget::LazyLoading);
playControlWidget->addStyleClass("panel");
playControlWidget->addStyleClass("panel-default");
playControlWidget->decorationStyle().setBackgroundColor(Wt::WColor("gainsboro"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment