dtolabs / yana2

Yet Another Node Authority ... because you wanted an agile Real-Time Service Model (RTSM)
8 stars 1 forks source link

Can't clone a node more than once #193

Open gschueler opened 12 years ago

gschueler commented 12 years ago

If you clone a node, then go back to the original and try to clone it again, it fails.

likely because the clone is always named after the original with "_clone" added to it, but since node names must be unique it fails to create another one with that name.

The clone action should automatically check for _clone and if it exists, add a number, e.g. _clone2 or _clone3, etc.

orubel commented 12 years ago

I had to do something similar for users with linkedin oauth creation where they didn't want a login except through Linkedin...

private boolean nodeNameLookup(String name){ Node nd = Node.findByName(name) if(nd==null){ return false }else{ return true } }

if(nodeNameLookup(name)){ int inc=1 nodename="${name}${inc}" while(nodeNameLookup(nodename)){ inc++ nodename="${name}${inc}" } }