mirror of
https://github.com/unraid/api.git
synced 2026-04-25 00:39:09 -05:00
25 lines
461 B
TypeScript
25 lines
461 B
TypeScript
/*!
|
|
* Copyright 2019-2020 Lime Technology Inc. All rights reserved.
|
|
* Written by: Alexis Tyler
|
|
*/
|
|
|
|
import { CoreContext, CoreResult } from '../types';
|
|
import { getPermissions } from '../utils';
|
|
|
|
/**
|
|
* Get current user.
|
|
*/
|
|
export const getMe = (context: CoreContext): CoreResult => {
|
|
const { user } = context;
|
|
|
|
const me = {
|
|
...user,
|
|
permissions: getPermissions(user.role)
|
|
};
|
|
|
|
return {
|
|
text: `Me: ${JSON.stringify(me, null, 2)}`,
|
|
json: me
|
|
};
|
|
};
|