0
0
Fork 0
mirror of https://github.com/kevinpapst/kimai2.git synced 2025-04-19 11:39:48 +00:00
kevinpapst_kimai2/assets/js/plugins/KimaiUser.js
Kevin Papst 2a75cd6230
random improvements (#5382)
* remove permission check, as own timesheets should always be visible
* new methods to create datetime
* allow access to user roles in javascript
* support class for dropdown actions
* allow to edit internal rate
* support human readable duration in export via user configuration
* allow to order timesheet listing by user, exported and billable field
* bump codecov action
2025-03-13 18:00:50 +01:00

59 lines
968 B
JavaScript

/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*!
* [KIMAI] KimaiUser: information about the current user
*/
import KimaiPlugin from "../KimaiPlugin";
export default class KimaiUser extends KimaiPlugin {
getId() {
return 'user';
}
init() {
this.user = this.getConfigurations().get('user');
}
/**
* @returns {string}
*/
getUserId() {
return this.user.id;
}
/**
* @returns {string}
*/
getName() {
return this.user.name;
}
/**
* @returns {boolean}
*/
isAdmin() {
return this.user.admin;
}
/**
* @returns {boolean}
*/
isSuperAdmin() {
return this.user.superAdmin;
}
/**
* @returns {array}
*/
getRoles() {
return this.user.roles;
}
}