mirror of
https://github.com/itsdave-de/msp.git
synced 2025-05-07 16:05:13 +02:00
added copy password to clipboard for IT User Account
added role IT User Account Manager
This commit is contained in:
parent
4f7b75dbe5
commit
5111280392
@ -98,7 +98,7 @@
|
|||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Status",
|
"label": "Status",
|
||||||
"options": "in Production\nImplementation\nin Maintenance\nDecommissioned"
|
"options": "in Production\nImplementation\nin Maintenance\nfailed\nDecommissioned"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "link",
|
"fieldname": "link",
|
||||||
@ -120,7 +120,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
"modified": "2021-03-23 21:28:29.467402",
|
"modified": "2021-03-24 13:25:22.542341",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "MSP",
|
"module": "MSP",
|
||||||
"name": "IT Object",
|
"name": "IT Object",
|
||||||
|
@ -2,7 +2,32 @@
|
|||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('IT User Account', {
|
frappe.ui.form.on('IT User Account', {
|
||||||
// refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
|
frm.add_custom_button('Copy PW', () => frm.trigger('get_pw'));
|
||||||
|
|
||||||
// }
|
},
|
||||||
|
get_pw: function(frm) {
|
||||||
|
frm.call('copy_pw', {
|
||||||
|
'user_agent': navigator.userAgent,
|
||||||
|
'platform': navigator.platform,
|
||||||
|
},
|
||||||
|
(r) => {
|
||||||
|
frm.events.CopyToClipboard(r.message)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
CopyToClipboard: function(value) {
|
||||||
|
var tempInput = document.createElement("input");
|
||||||
|
tempInput.value = value;
|
||||||
|
document.body.appendChild(tempInput);
|
||||||
|
tempInput.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
document.body.removeChild(tempInput);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
"label": "UPN"
|
"label": "UPN"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2021-03-24 00:27:17.507476",
|
"modified": "2021-03-24 13:31:10.543697",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "MSP",
|
"module": "MSP",
|
||||||
"name": "IT User Account",
|
"name": "IT User Account",
|
||||||
@ -68,7 +68,7 @@
|
|||||||
"print": 1,
|
"print": 1,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
"role": "System Manager",
|
"role": "IT User Account Manager",
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,23 @@
|
|||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
# import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class ITUserAccount(Document):
|
class ITUserAccount(Document):
|
||||||
pass
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def copy_pw(self, user_agent, platform):
|
||||||
|
"""
|
||||||
|
pw_access_doc = frappe.get_doc({
|
||||||
|
"doctype": "User Account Password Access",
|
||||||
|
"access_datetime": frappe.utils.datetime.datetime.now(),
|
||||||
|
"user": frappe.session.user,
|
||||||
|
"ip": frappe.local.request_ip,
|
||||||
|
"method": "copy_pw",
|
||||||
|
"platform": platform,
|
||||||
|
"user_agent": user_agent})
|
||||||
|
self.append("access_history", pw_access_doc)
|
||||||
|
self.save()
|
||||||
|
"""
|
||||||
|
return(self.get_password("password"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user