def get_accessible_dag_ids(self, username=None):
if not username:<EOL><INDENT>username = g.user<EOL><DEDENT>if username.is_anonymous or '<STR_LIT>' in username.roles:<EOL><INDENT>return set()<EOL><DEDENT>roles = {role.name for role in username.roles}<EOL>if {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'} & roles:<EOL><INDENT>return self.DAG_VMS<EOL><DEDENT>user_perms_views = self.get_all_permissions_views()<EOL>return set([view for perm, view in user_perms_views if perm in self.DAG_PERMS])<EOL>
Return a set of dags that user has access to(either read or write).

:param username: Name of the user.
:return: A set of dag ids that the user could access.