def get_shared(doctype, user=None, rights=None):
 if (not user):
  user = frappe.session.user
 if (not rights):
  rights = [u'read']
 condition = u' and '.join([u'`{0}`=1'.format(right) for right in rights])
 return frappe.db.sql_list(u'select share_name from tabDocShare\n DCTB  DCTB where (user=%s {everyone}) and share_doctype=%s and {condition}'.format(condition=condition, everyone=(u'or everyone=1' if (user != u'Guest') else u'')), (user, doctype))

def get_shared ( doctype , user = None , rights = None ) : if ( not user ) : user = frappe . session . user if ( not rights ) : rights = [ u'read' ] condition = u' and ' . join ( [ u'`{0}`=1' . format ( right ) for right in rights ] ) return frappe . db . sql_list ( u'select share_name from tabDocShare\n DCTB  DCTB where (user=%s {everyone}) and share_doctype=%s and {condition}' . format ( condition = condition , everyone = ( u'or everyone=1' if ( user != u'Guest' ) else u'' ) ) , ( user , doctype ) )
get list of shared document names for given user and doctype .