|
|
|
|
@@ -43,6 +43,20 @@
|
|
|
|
|
allpermissions=allpermissions.concat([p.target + ":" + p.action])
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
// editable_userdata.permissions=[];
|
|
|
|
|
const user_permissions = UserService.userControllerGetPermissions(params.userid).then((val) => {
|
|
|
|
|
// console.log(val);
|
|
|
|
|
editable_userdata.permissions=[]
|
|
|
|
|
val.directlyGranted.forEach(p => {
|
|
|
|
|
editable_userdata.permissions=editable_userdata.permissions.concat([p.target + ":" + p.action])
|
|
|
|
|
});
|
|
|
|
|
val.inherited.forEach(p => {
|
|
|
|
|
editable_userdata.permissions=editable_userdata.permissions.concat([p.target + ":" + p.action])
|
|
|
|
|
});
|
|
|
|
|
// editable_userdata.permissions.push()
|
|
|
|
|
// console.log(val.directlyGranted);
|
|
|
|
|
// console.log(val.inherited);
|
|
|
|
|
})
|
|
|
|
|
$: changes_performed = !lodashIsEqual(original_data, editable_userdata);
|
|
|
|
|
$: groups_changed = JSON.stringify(usergroups_array)===JSON.stringify(usergroups_array_original);
|
|
|
|
|
$: save_enabled = changes_performed||!groups_changed;
|
|
|
|
|
@@ -171,18 +185,24 @@
|
|
|
|
|
{/if}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mt-2 flex items-center">
|
|
|
|
|
<div class="mt-3 text-sm w-full">
|
|
|
|
|
<p
|
|
|
|
|
class="ml-1 font-medium text-gray-700">Profile Picture</p>
|
|
|
|
|
<img
|
|
|
|
|
alt={$_('profile-picture')}
|
|
|
|
|
class="inline-block h-20 w-20 rounded-full overflow-hidden bg-gray-100"
|
|
|
|
|
class="h-20 w-20 rounded-full overflow-hidden bg-gray-100"
|
|
|
|
|
src={editable_userdata.profilePic} />
|
|
|
|
|
<button
|
|
|
|
|
<!-- <button
|
|
|
|
|
type="button"
|
|
|
|
|
class="ml-5 bg-white py-2 px-3 border border-gray-300 rounded-md shadow-sm text-sm leading-4 font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Change</button>
|
|
|
|
|
class="ml-5 bg-white py-2 px-3 border border-gray-300 rounded-md shadow-sm text-sm leading-4 font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Change</button> -->
|
|
|
|
|
</div>
|
|
|
|
|
<!-- -->
|
|
|
|
|
<div class="mt-3 text-sm w-full">
|
|
|
|
|
<input
|
|
|
|
|
<label
|
|
|
|
|
for="enabled"
|
|
|
|
|
class="ml-1 font-medium text-gray-700">Active?</label>
|
|
|
|
|
<br>
|
|
|
|
|
<p class="text-gray-500"> <input
|
|
|
|
|
id="enabled"
|
|
|
|
|
on:change={() => {
|
|
|
|
|
editable_userdata.enabled = !editable_userdata.enabled;
|
|
|
|
|
@@ -191,11 +211,7 @@
|
|
|
|
|
name="enabled"
|
|
|
|
|
type="checkbox"
|
|
|
|
|
checked={editable_userdata.enabled}
|
|
|
|
|
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" />
|
|
|
|
|
<label
|
|
|
|
|
for="enabled"
|
|
|
|
|
class="ml-1 font-medium text-gray-700">Active?</label>
|
|
|
|
|
<p class="text-gray-500">set the user active/ inactive</p>
|
|
|
|
|
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" /> set the user active/ inactive</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text-sm w-full">
|
|
|
|
|
<label
|
|
|
|
|
@@ -291,8 +307,8 @@
|
|
|
|
|
class="border-4 border-dashed rounded mb-4 p-5 text-lg text-center">
|
|
|
|
|
{#each allpermissions as p}
|
|
|
|
|
{#if !editable_userdata.permissions.includes(p)}
|
|
|
|
|
<p
|
|
|
|
|
class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 bg-gray-200 p-2 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input">
|
|
|
|
|
<div
|
|
|
|
|
class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 bg-gray-200 p-2 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input text-right">
|
|
|
|
|
{p}
|
|
|
|
|
<button
|
|
|
|
|
on:click={() => {
|
|
|
|
|
@@ -300,8 +316,8 @@
|
|
|
|
|
editable_userdata.permissions = editable_userdata.permissions;
|
|
|
|
|
}}
|
|
|
|
|
type="button"
|
|
|
|
|
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-green-200 text-base font-medium text-black hover:bg-green-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 sm:ml-3 sm:w-auto sm:text-sm">+</button>
|
|
|
|
|
</p>
|
|
|
|
|
class="w-full rounded-md border border-transparent shadow-sm px-4 py-2 bg-green-200 font-medium text-black hover:bg-green-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 sm:ml-3 sm:w-auto sm:text-sm">+</button>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
@@ -311,16 +327,16 @@
|
|
|
|
|
class="border-4 border-dashed rounded mb-4 p-5 text-lg text-center">
|
|
|
|
|
{#each allpermissions as p}
|
|
|
|
|
{#if editable_userdata.permissions.includes(p)}
|
|
|
|
|
<p
|
|
|
|
|
class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 bg-gray-200 p-2 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input">
|
|
|
|
|
{p}
|
|
|
|
|
<button
|
|
|
|
|
<div
|
|
|
|
|
class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 bg-gray-200 p-2 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input text-left">
|
|
|
|
|
<button
|
|
|
|
|
on:click={() => {
|
|
|
|
|
editable_userdata.permissions = editable_userdata.permissions.filter((obj) => obj !== p);
|
|
|
|
|
}}
|
|
|
|
|
type="button"
|
|
|
|
|
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-300 text-base font-medium text-black hover:bg-red-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm">-</button>
|
|
|
|
|
</p>
|
|
|
|
|
class="w-full rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-400 font-medium text-black hover:bg-red-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm">-</button>
|
|
|
|
|
{p}
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
|