- this.IsFirstAuth = function(rno){\r
- if(!this.IsContains(rno) || typeof(collection[rno].owner) == "undefined")\r
- return false;\r
- return collection[rno].owner == null;\r
- }\r
- this.IsAuthed = function(rno,name){\r
- if(!this.IsContains(rno))\r
- return false;\r
- console.log(util.inspect(collection[rno].authed_list));\r
- return name == collection[rno].owner ||\r
- name in collection[rno].authed_list;\r
- };\r
- this.IsFixedPassword = function(rno){\r
- if(!this.IsContains(rno))\r
- return false;\r
- return collection[rno].owner == $system_name;\r
- };\r
- this.IsOwner = function(rno,name){\r
- return this.IsContains(rno) &&\r
- typeof(collection[rno].owner) != "undefined" &&\r
- collection[rno].owner == name;\r
- }\r
- this.IsTimeout = function(rno){\r
- var date = new Date();\r
- var time = date.getTime();\r
- return this.IsContains(rno) &&\r
- !this.IsFixedPassword(rno) &&\r
- (typeof(collection[rno].time) != "undefined" &&\r
- time - collection[rno].time >= $reset_password_diff);\r
- };\r
- this.RemoveAuth = function(rno,name)\r
- {\r
- delete collection[rno].authed_list[name];\r
- }\r
- this.Auth = function(rno,name,password){\r
- if(typeof(collection[rno].password) != "undefined" &&\r
- collection[rno].password != password)\r
- return false;\r
- var date = new Date();\r
- var time = date.getTime();\r
- collection[rno].time = time;\r
- collection[rno].authed_list[name] = "";\r
- return true;\r
- }\r
- this.SetPassword = function(rno,owner,password){\r
- if(this.IsContains(rno) && \r
- owner == collection[rno].owner &&\r
- !this.IsFixedPassword(rno))\r
- {\r
- var date = new Date();\r
- collection[rno].time = date.getTime();\r
- collection[rno].password = password;\r
- \r
- console.log(util.format("password is seted to %s in %s",password,rno));\r
- return true;\r
- }\r
- return false;\r
- };\r