Skip to content
Snippets Groups Projects
Commit 4d306d87 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Explicitly treat zero

parent b667b3b5
No related branches found
No related tags found
No related merge requests found
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
<h4>Add external users</h4> <h4>Add external users</h4>
<p>Employees and students are allowed to create external users for collaboration with actors outside of Linköpings University.<br/> <p>Employees and students are allowed to create external users for collaboration with actors outside of Linköpings University.<br/>
This application will track and allow creation of such external users, up to a number configurable by the administrators.<br/></p> This application will track and allow creation of such external users, up to a number configurable by the administrators.<br/></p>
<button class="btn btn-success" :disabled="user.eum_settings.external_limit > 0 && external.length >= user.eum_settings.external_limit" @click="showCreationForm = !showCreationForm">New External User</button> <button class="btn btn-success" :disabled="user.eum_settings.external_limit >= 0 && external.length >= user.eum_settings.external_limit" @click="showCreationForm = !showCreationForm">New External User</button>
</div> </div>
</transition> </transition>
<h2 class="mt-4 mb-3">Existing external users: ({{ external.length }}/<span v-if="user.eum_settings.external_limit > 0">{{ user.eum_settings.external_limit }}</span><span v-else>&infin;</span>)</h2> <h2 class="mt-4 mb-3">Existing external users: ({{ external.length }}/<span v-if="user.eum_settings.external_limit >= 0">{{ user.eum_settings.external_limit }}</span><span v-else>&infin;</span>)</h2>
<hr/> <hr/>
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<ul class="list-unstyled" is="transition-group" name="flip-list" v-if="external"> <ul class="list-unstyled" is="transition-group" name="flip-list" v-if="external">
......
...@@ -40,6 +40,10 @@ router.post('/', async (req, res) => { ...@@ -40,6 +40,10 @@ router.post('/', async (req, res) => {
.reduce( (rs, key) => (rs[key] = req.body[key], rs), {} ) .reduce( (rs, key) => (rs[key] = req.body[key], rs), {} )
) )
if (req.user.eum_settings.external_limit == 0) {
return res.status(401).send({ 'message': 'No external users allowed' });
}
if (req.user.eum_settings.external_limit > 0) { if (req.user.eum_settings.external_limit > 0) {
try { try {
const queryText = 'SELECT * FROM external_users WHERE owner_id = $1'; const queryText = 'SELECT * FROM external_users WHERE owner_id = $1';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment