@ -41,6 +41,7 @@ import org.apache.dolphinscheduler.dao.entity.AccessToken;
import org.apache.dolphinscheduler.dao.entity.AlertGroup ;
import org.apache.dolphinscheduler.dao.entity.DataSource ;
import org.apache.dolphinscheduler.dao.entity.Environment ;
import org.apache.dolphinscheduler.dao.entity.K8sNamespace ;
import org.apache.dolphinscheduler.dao.entity.Project ;
import org.apache.dolphinscheduler.dao.entity.Queue ;
import org.apache.dolphinscheduler.dao.entity.Resource ;
@ -48,6 +49,7 @@ import org.apache.dolphinscheduler.dao.entity.TaskGroup;
import org.apache.dolphinscheduler.dao.entity.Tenant ;
import org.apache.dolphinscheduler.dao.entity.UdfFunc ;
import org.apache.dolphinscheduler.dao.entity.User ;
import org.apache.dolphinscheduler.dao.entity.WorkerGroup ;
import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper ;
import org.apache.dolphinscheduler.dao.mapper.AlertGroupMapper ;
import org.apache.dolphinscheduler.dao.mapper.AlertPluginInstanceMapper ;
@ -180,8 +182,7 @@ public class ResourcePermissionCheckServiceImpl
return Collections . emptySet ( ) ;
}
List < Queue > queues = queueMapper . selectList ( null ) ;
return CollectionUtils . isEmpty ( queues ) ? Collections . emptySet ( )
: queues . stream ( ) . map ( Queue : : getId ) . collect ( toSet ( ) ) ;
return queues . stream ( ) . map ( Queue : : getId ) . collect ( toSet ( ) ) ;
}
}
@ -267,9 +268,6 @@ public class ResourcePermissionCheckServiceImpl
@Override
public Set < Integer > listAuthorizedResource ( int userId , Logger logger ) {
List < UdfFunc > udfFuncList = udfFuncMapper . listAuthorizedUdfByUserId ( userId ) ;
if ( CollectionUtils . isEmpty ( udfFuncList ) ) {
return Collections . emptySet ( ) ;
}
return udfFuncList . stream ( ) . map ( UdfFunc : : getId ) . collect ( toSet ( ) ) ;
}
@ -296,9 +294,6 @@ public class ResourcePermissionCheckServiceImpl
@Override
public Set < Integer > listAuthorizedResource ( int userId , Logger logger ) {
List < TaskGroup > taskGroupList = taskGroupMapper . listAuthorizedResource ( userId ) ;
if ( CollectionUtils . isEmpty ( taskGroupList ) ) {
return Collections . emptySet ( ) ;
}
return taskGroupList . stream ( ) . map ( TaskGroup : : getId ) . collect ( Collectors . toSet ( ) ) ;
}
@ -329,7 +324,8 @@ public class ResourcePermissionCheckServiceImpl
@Override
public Set < Integer > listAuthorizedResource ( int userId , Logger logger ) {
return Collections . emptySet ( ) ;
List < K8sNamespace > k8sNamespaces = k8sNamespaceMapper . queryAuthedNamespaceListByUserId ( userId ) ;
return k8sNamespaces . stream ( ) . map ( K8sNamespace : : getId ) . collect ( Collectors . toSet ( ) ) ;
}
}
@ -355,9 +351,6 @@ public class ResourcePermissionCheckServiceImpl
@Override
public Set < Integer > listAuthorizedResource ( int userId , Logger logger ) {
List < Environment > environments = environmentMapper . queryAllEnvironmentList ( ) ;
if ( CollectionUtils . isEmpty ( environments ) ) {
return Collections . emptySet ( ) ;
}
return environments . stream ( ) . map ( Environment : : getId ) . collect ( Collectors . toSet ( ) ) ;
}
}
@ -383,7 +376,8 @@ public class ResourcePermissionCheckServiceImpl
@Override
public Set < Integer > listAuthorizedResource ( int userId , Logger logger ) {
return Collections . emptySet ( ) ;
List < WorkerGroup > workerGroups = workerGroupMapper . queryAllWorkerGroup ( ) ;
return workerGroups . stream ( ) . map ( WorkerGroup : : getId ) . collect ( Collectors . toSet ( ) ) ;
}
}
@ -468,9 +462,6 @@ public class ResourcePermissionCheckServiceImpl
@Override
public Set < Integer > listAuthorizedResource ( int userId , Logger logger ) {
if ( userId ! = 0 ) {
return Collections . emptySet ( ) ;
}
List < Tenant > tenantList = tenantMapper . queryAll ( ) ;
return tenantList . stream ( ) . map ( Tenant : : getId ) . collect ( Collectors . toSet ( ) ) ;
}