fixes visible scope on versions
fixes name clashes in sql scope
static active authorization condition
fixes authorization for inactive permissions